diff --git a/content/apps/F-Droid Security Analysis.md b/content/apps/F-Droid Security Analysis.md index 541e021..6082bfb 100644 --- a/content/apps/F-Droid Security Analysis.md +++ b/content/apps/F-Droid Security Analysis.md @@ -1,6 +1,5 @@ --- title: "F-Droid Security Analysis" -date: 2022-01-02T21:28:31Z tags: ['software', 'android', 'security'] author: Wonderfall canonicalURL: https://wonderfall.dev/fdroid-issues @@ -155,7 +154,6 @@ In modern Android, the background restriction toggle is what really provides the Another example to illustrate the shortcomings of this approach would be the `QUERY_ALL_PACKAGES` low-level permission, which is referred to as the *query all packages* permission that "allows an app to see all installed packages". While this is somewhat correct, this can also be misleading: apps do not need `QUERY_ALL_PACKAGES` to list other apps within the same user profile. Even without this permission, some apps are visible automatically (visibility is restricted by default [since Android 11](https://developer.android.com/training/package-visibility)). If an app needs more visibility, it will declare a `` element in its manifest file: in other words, `QUERY_ALL_PACKAGES` is only one way to achieve visibility. Again, this goes to show low-level manifest permissions are not intended to be interpreted as high-level permissions the user should fully comprehend. -Play Store for instance conveys the permissions in a way less misleading way: the main low-level permissions are first grouped in their high-level user-facing toggles, and the rest is shown under "Other". This permission list can only be accessed by taping "About this app" then "App permissions - See more" at the bottom of the page. Play Store will tell the app may request access to the following permissions: this kind of wording is more important than it seems. *Update: since July 2022, Play Store doesn't offer a way to display low-level permissions anymore.* Moreover, [Play Store restricts the use of highly invasive permissions](https://support.google.com/googleplay/android-developer/answer/9888170) such as `MANAGE_EXTERNAL_STORAGE` which allows apps to opt out of scoped storage if they can't work with [more privacy friendly approaches](https://developer.android.com/guide/topics/providers/document-provider) (like a file explorer). Apps that can't justify their use of this permission (which again has to be granted dynamically) may be removed from Play Store. This is where an app repository can actually be useful in their review process to protect end-users from installing poorly made apps that might compromise their privacy. Not that it matters much if these apps target very old API levels that are inclined to require invasive permissions in the first place... diff --git a/content/os/Docker and OCI Hardening.md b/content/os/Docker and OCI Hardening.md index b0c46d4..47fe297 100644 --- a/content/os/Docker and OCI Hardening.md +++ b/content/os/Docker and OCI Hardening.md @@ -1,6 +1,5 @@ --- title: "Docker and OCI Hardening" -date: 2022-03-30T21:23:12Z tags: ['operating systems', 'linux', 'container', 'security'] author: Wonderfall canonicalURL: https://wonderfall.dev/docker-hardening/ diff --git a/content/os/Securing OpenSSH with FIDO2.md b/content/os/Securing OpenSSH with FIDO2.md new file mode 100644 index 0000000..1efa480 --- /dev/null +++ b/content/os/Securing OpenSSH with FIDO2.md @@ -0,0 +1,74 @@ +--- +title: "Securing OpenSSH with FIDO2" +tags: ['operating systems', 'linux', 'security'] +author: Wonderfall +canonicalURL: https://wonderfall.dev/openssh-fido2/ +ShowCanonicalLink: true +--- + +Passwordless authentication with OpenSSH keys has been the *de facto* security standard for years. SSH keys are more robust since they're cryptographically sane by default, and are therefore resilient to most bruteforce atacks. They're also easier to manage while enabling a form of decentralized authentication (it's easy and painless to revoke them). So, what's the next step? And more exactly, why would one need something even better? + + +## Why? + +The main problem with SSH keys is that they're not magic: they consist of a key pair, of which the private key is stored on your disk. You should be wary of various exfiltration attempts, depending on your theat model: + +- If your disk is not encrypted, any physical access could compromise your keys. +- If your private key isn't encrypted, malicious applications could compromise it. +- Even with both encrypted, malicious applications could register your keystrokes. + +All these attempts are particularly a thing on desktop platforms, because they don't have a proper sandboxing model. On Windows, non-UWP apps could likely have full access to your `.ssh` directory. On desktop Linux distributions, sandboxing is also lacking, and the situation is even worse if you're using X.org since it allows apps to spy on each other (and on your keyboard) by design. A first good step would be to only use SSH from a trusted & decently secure system. + +Another layer of defense would obviously be multi-factor authentification, or the fact that you're relying on a shared secret instead. We can use FIDO2 security keys for that. That way, even if your private key is compromised, the attacker needs physical access to your security key. TOTP is another common 2FA technique, but it's vulnerable to various attacks, and relies on the quality of the implementation on the server. + + +## How? + +Fortunately for us, [OpenSSH 8.2](https://www.openssh.com/txt/release-8.2) (released in February 2020) introduced native support for FIDO2/U2F. Most OpenSSH distributions should have the middleware set to use the `libfido2` library, including portable versions such as the one [for Win32](https://github.com/PowerShell/Win32-OpenSSH). + +Basically, `ssh-keygen -t ${key_type}-sk` will generate for us a token-backed key pair. The key types that are supported depend on your security key. Newer models should support both ECDSA-P256 (`ecdsa-sk`) and Ed25519 (`ed25519-sk`). If the latter is available, you should prefer it. + +### Client configuration +To get started: + +``` +ssh-keygen -t ed25519-sk +``` + +This will generate a `id_ed25519_sk` private key and a `id_ed25519_sk.pub` public key in `.ssh`. These are defaults, but you can change them if you want. We will call this key pair a "handle", because they're not sufficient by themselves to derive the real secret (as you guessed it, the FIDO2 token is needed). `ssh-keygen` should ask you to touch the key, and enter the PIN prior to that if you did set one (you probably should). + +You can also generate a **resident key** (referred to as *discoverable credential* in the WebAuthn specification): + +``` +ssh-keygen -t ed25519-sk -O resident -O application=ssh:user1 +``` + +As you can see, a few options must be specified: + +- `-O resident` will tell `ssh-keygen` to generate a resident key, meaning that the private "handle" key will also be stored on the security key itself. This has security implications, but you may want that to move seamlessly between different computers. In that case, you should absolutely protect your key with a PIN beforehand. +- `-O application=ssh:` is necessary to instruct that the resident key will use a particular slot, because the security key will have to index the resident keys (by default, they use `ssh:` with an empty user ID). If this is not specificed, the next key generation might overwrite the previous one. +- `-O verify-required` is optional but instructs that a PIN is required to generate/access the key. + +Resident keys can be retrieved using `ssh-keygen -K` or `ssh-add -K` if you don't want to write them to the disk. + +### Server configuration +Next, transfer your public key over to the server (granted you have already access to it with a regular key pair): + +``` +ssh-copy-id -i ~/.ssh/id_ed25519_sk.pub user@server.domain.tld +``` + +*Ta-da!* But one last thing: we need to make sure the server supports this public key format in `sshd_config`: + +``` +PubkeyAcceptedKeyTypes ssh-ed25519,sk-ssh-ed25519@openssh.com +``` + +Adding `sk-ssh-ed25519@openssh.com` to `PubkeyAcceptedKeyTypes` should suffice. It's best practice to only use the cryptographic primitives that you need, and hopefully ones that are also modern. This isn't a full-on SSH hardening guide, but you should take a look at the [configuration file GrapheneOS uses](https://github.com/GrapheneOS/infrastructure/blob/main/sshd_config) for their servers to give you an idea on a few good practices. + +Restart the `sshd` service and try to connect to your server using your key handle (by passing `-i ~/.ssh/id_ed25519_sk` to `ssh` for instance). If that works for you (your FIDO2 security key should be needed to derive the real secret), feel free to remove your previous keys from `.ssh/authorized_keys` on your server. + +## That's cool, right? +If you don't have a security key, you can buy one from [YubiKey](https://www.yubico.com/fr/store/) (I'm very happy with my 5C NFC by the way), [Nitrokey](https://www.nitrokey.com/), [SoloKeys](https://solokeys.com/) or [OnlyKey](https://onlykey.io/) (to name a few). If you have an Android device with a hardware security module (HSM), such as the Google Pixels equipped with Titan M (Pixel 3+), you could even use them as bluetooth security keys. + +*No reason to miss out on the party if you can afford it!* \ No newline at end of file diff --git a/external-blogs.sh b/external-blogs.sh index cbc8e85..dabc4fd 100755 --- a/external-blogs.sh +++ b/external-blogs.sh @@ -4,7 +4,8 @@ rm -rf './content/apps/F-Droid Security Analysis.md' curl https://raw.githubusercontent.com/Wonderfall/wonderfall.github.io/main/content/posts/fdroid-issues.md -o './content/apps/F-Droid Security Analysis.md' sed -i 's/title:.*/title: "F-Droid Security Analysis"/' './content/apps/F-Droid Security Analysis.md' -sed -i '/draft: false/d' './content/apps/F-Droid Security Analysis.md' +sed -i '/date:.*/d' './content/apps/F-Droid Security Analysis.md' +sed -i '/draft:.*/d' './content/apps/F-Droid Security Analysis.md' sed -i "s/tags:.*/tags: ['applications', 'android', 'security']/" './content/apps/F-Droid Security Analysis.md' sed -i '/^tags:.*/a ShowCanonicalLink: true' './content/apps/F-Droid Security Analysis.md' sed -i '/^tags:.*/a canonicalURL: https://wonderfall.dev/fdroid-issues' './content/apps/F-Droid Security Analysis.md' @@ -14,8 +15,20 @@ sed -i '/^tags:.*/a author: Wonderfall' './content/apps/F-Droid Security Analysi rm -rf './content/os/Docker and OCI Hardening.md' curl https://raw.githubusercontent.com/Wonderfall/wonderfall.github.io/main/content/posts/docker-hardening.md -o './content/os/Docker and OCI Hardening.md' sed -i 's/title:.*/title: "Docker and OCI Hardening"/' './content/os/Docker and OCI Hardening.md' -sed -i '/draft: false/d' './content/os/Docker and OCI Hardening.md' +sed -i '/date:.*/d' './content/os/Docker and OCI Hardening.md' +sed -i '/draft:.*/d' './content/os/Docker and OCI Hardening.md' sed -i "s/tags:.*/tags: ['operating systems', 'linux', 'container', 'security']/" './content/os/Docker and OCI Hardening.md' sed -i '/^tags:.*/a ShowCanonicalLink: true' './content/os/Docker and OCI Hardening.md' sed -i '/^tags:.*/a canonicalURL: https://wonderfall.dev/docker-hardening/' './content/os/Docker and OCI Hardening.md' -sed -i '/^tags:.*/a author: Wonderfall' './content/os/Docker and OCI Hardening.md' \ No newline at end of file +sed -i '/^tags:.*/a author: Wonderfall' './content/os/Docker and OCI Hardening.md' + +#Securing OpenSSH with FIDO2 +rm -rf './content/os/Securing OpenSSH with FIDO2.md' +curl https://raw.githubusercontent.com/Wonderfall/wonderfall.github.io/main/content/posts/openssh-fido2.md -o './content/os/Securing OpenSSH with FIDO2.md' +sed -i 's/title:.*/title: "Securing OpenSSH with FIDO2"/' './content/os/Securing OpenSSH with FIDO2.md' +sed -i '/date:.*/d' './content/os/Securing OpenSSH with FIDO2.md' +sed -i '/draft:.*/d' './content/os/Securing OpenSSH with FIDO2.md' +sed -i "s/tags:.*/tags: ['operating systems', 'linux', 'security']/" './content/os/Securing OpenSSH with FIDO2.md' +sed -i '/^tags:.*/a ShowCanonicalLink: true' './content/os/Securing OpenSSH with FIDO2.md' +sed -i '/^tags:.*/a canonicalURL: https://wonderfall.dev/openssh-fido2/' './content/os/Securing OpenSSH with FIDO2.md' +sed -i '/^tags:.*/a author: Wonderfall' './content/os/Securing OpenSSH with FIDO2.md' \ No newline at end of file diff --git a/public/apps/f-droid-security-analysis/index.html b/public/apps/f-droid-security-analysis/index.html index 8d34ed6..86693fb 100644 --- a/public/apps/f-droid-security-analysis/index.html +++ b/public/apps/f-droid-security-analysis/index.html @@ -3,9 +3,9 @@ Before we start, a few things to keep in mind: The main goal of this write-up was to inform users so they can make responsible choices, not to trash someone else’s work.">

F-Droid Security Analysis

25 min · 5298 words · Wonderfall
\ No newline at end of file diff --git a/public/apps/index.xml b/public/apps/index.xml index f177e6f..63e2458 100644 --- a/public/apps/index.xml +++ b/public/apps/index.xml @@ -4,12 +4,11 @@ Applications on PrivSec.dev https://privsec.dev/apps/ Recent content in Applications on PrivSec.dev - Hugo -- gohugo.io - Sun, 02 Jan 2022 21:28:31 +0000 + Hugo -- gohugo.io F-Droid Security Analysis https://privsec.dev/apps/f-droid-security-analysis/ - Sun, 02 Jan 2022 21:28:31 +0000 + Mon, 01 Jan 0001 00:00:00 +0000 https://privsec.dev/apps/f-droid-security-analysis/ F-Droid is a popular alternative app repository for Android, especially known for its main repository dedicated to free and open-source software. F-Droid is often recommended among security and privacy enthusiasts, but how does it stack up against Play Store in practice? This write-up will attempt to emphasize major security issues with F-Droid that you should consider. diff --git a/public/index.xml b/public/index.xml index 519db6c..180b218 100644 --- a/public/index.xml +++ b/public/index.xml @@ -4,31 +4,7 @@ PrivSec.dev https://privsec.dev/ Recent content on PrivSec.dev - Hugo -- gohugo.io - Wed, 30 Mar 2022 21:23:12 +0000 - - Docker and OCI Hardening - https://privsec.dev/os/docker-and-oci-hardening/ - Wed, 30 Mar 2022 21:23:12 +0000 - - https://privsec.dev/os/docker-and-oci-hardening/ - Containers aren’t that new fancy thing anymore, but they were a big deal. And they still are. They are a concrete solution to the following problem: -- Hey, your software doesn’t work… -- Sorry, it works on my computer! Can’t help you. -Whether we like them or not, containers are here to stay. Their expressiveness and semantics allow for an abstraction of the OS dependencies that a software has, the latter being often dynamically linked against certain libraries. - - - - F-Droid Security Analysis - https://privsec.dev/apps/f-droid-security-analysis/ - Sun, 02 Jan 2022 21:28:31 +0000 - - https://privsec.dev/apps/f-droid-security-analysis/ - F-Droid is a popular alternative app repository for Android, especially known for its main repository dedicated to free and open-source software. F-Droid is often recommended among security and privacy enthusiasts, but how does it stack up against Play Store in practice? This write-up will attempt to emphasize major security issues with F-Droid that you should consider. -Before we start, a few things to keep in mind: -The main goal of this write-up was to inform users so they can make responsible choices, not to trash someone else’s work. - - + Hugo -- gohugo.io About Us https://privsec.dev/about/ @@ -41,6 +17,18 @@ Tommy System Administrator. Benevolent dictator for life @privsec.dev. Website: tommytran.io + + Docker and OCI Hardening + https://privsec.dev/os/docker-and-oci-hardening/ + Mon, 01 Jan 0001 00:00:00 +0000 + + https://privsec.dev/os/docker-and-oci-hardening/ + Containers aren’t that new fancy thing anymore, but they were a big deal. And they still are. They are a concrete solution to the following problem: +- Hey, your software doesn’t work… +- Sorry, it works on my computer! Can’t help you. +Whether we like them or not, containers are here to stay. Their expressiveness and semantics allow for an abstraction of the OS dependencies that a software has, the latter being often dynamically linked against certain libraries. + + Donate https://privsec.dev/donate/ @@ -50,6 +38,17 @@ Website: tommytran.io The domain costs us $12/year to renew from Google. We got our repository hosted for free on GitHub. We got our site hosted for free with Firebase. It costs Tommy ~$20/month to run the mail server, but that server is used for a bunch of his projects, not just PrivSec, and we doubt it will be used that much anyways. The point is, this website does not cost much to run, and as such we will not be accepting donation as a project. + + F-Droid Security Analysis + https://privsec.dev/apps/f-droid-security-analysis/ + Mon, 01 Jan 0001 00:00:00 +0000 + + https://privsec.dev/apps/f-droid-security-analysis/ + F-Droid is a popular alternative app repository for Android, especially known for its main repository dedicated to free and open-source software. F-Droid is often recommended among security and privacy enthusiasts, but how does it stack up against Play Store in practice? This write-up will attempt to emphasize major security issues with F-Droid that you should consider. +Before we start, a few things to keep in mind: +The main goal of this write-up was to inform users so they can make responsible choices, not to trash someone else’s work. + + Linux Insecurities https://privsec.dev/os/linux-insecurities/ @@ -70,5 +69,15 @@ There is already a very indepth technical blog explaning the various security we Common protocols Email and SMS MFA Email and SMS MFA are examples of the weaker MFA protocols. Email MFA is not great as whoever controls your email account can typically both reset your password and recieve your MFA verification. + + Securing OpenSSH with FIDO2 + https://privsec.dev/os/securing-openssh-with-fido2/ + Mon, 01 Jan 0001 00:00:00 +0000 + + https://privsec.dev/os/securing-openssh-with-fido2/ + Passwordless authentication with OpenSSH keys has been the de facto security standard for years. SSH keys are more robust since they’re cryptographically sane by default, and are therefore resilient to most bruteforce atacks. They’re also easier to manage while enabling a form of decentralized authentication (it’s easy and painless to revoke them). So, what’s the next step? And more exactly, why would one need something even better? +Why? The main problem with SSH keys is that they’re not magic: they consist of a key pair, of which the private key is stored on your disk. + + diff --git a/public/os/docker-and-oci-hardening/index.html b/public/os/docker-and-oci-hardening/index.html index 07252e0..db0fabc 100644 --- a/public/os/docker-and-oci-hardening/index.html +++ b/public/os/docker-and-oci-hardening/index.html @@ -5,10 +5,10 @@ Whether we like them or not, containers are here to stay. Their expressiveness a

Docker and OCI Hardening

Docker and OCI Hardening

Containers aren’t that new fancy thing anymore, but they were a big deal. And they still are. They are a concrete solution to the following problem: - Hey, your software doesn’t work… - Sorry, it works on my computer! Can’t help you. -Whether we like them or not, containers are here to stay. Their expressiveness and semantics allow for an abstraction of the OS dependencies that a software has, the latter being often dynamically linked against certain libraries....

March 30, 2022 · 19 min · 3925 words · Wonderfall

Linux Insecurities

There is a common misconception among privacy communities that Linux is one of the more secure operating systems, either because it is open source or because it is widely used in the cloud. This is however, a far cry from reality. -There is already a very indepth technical blog explaning the various security weaknesses of Linux by Madaidan, Whonix’s Security Researcher. This page will attempt to address some of the questions commonly raised in reaction to his blog post....

1 min · 86 words · Tommy