Skip to content

add cert pinning for nine f-droid repositories#1141

Merged
Iamlooker merged 1 commit intoDroid-ify:mainfrom
flexxxxer:main
Nov 21, 2025
Merged

add cert pinning for nine f-droid repositories#1141
Iamlooker merged 1 commit intoDroid-ify:mainfrom
flexxxxer:main

Conversation

@flexxxxer
Copy link
Copy Markdown
Contributor

https://developer.android.com/privacy-and-security/security-config
Network security config allows to pin certs for specific domains (see Pin certificates section on page above), so MITM harder to perform successfully.

It is possible to make pinning to CA certificates (and this is exactly what I had done in PR changes):

Certificate pinning is done by providing a set of certificates by hash of the public key (SubjectPublicKeyInfo of the X.509 certificate). A certificate chain is then valid only if the certificate chain contains at least one of the pinned public keys.

But after expiration date pinning is not performed (this is one of the reasons to keep updates enabled for many apps):

Additionally, it is possible to set an expiration time for pins after which pinning is not performed. This helps prevent connectivity issues in apps which have not been updated. However, setting an expiration time on pins may enable attackers to bypass your pinned certificates

Cert pinning was added for next domains: f-droid.org, guardianproject.info, apt.izzysoft.de, app.futo.org, molly.im, app.simplex.chat, briarproject.org, microg.org, cdn.kde.org . There are plans to add pinning for some others (IronFox and Brave repos)

Changes are tested. This is how I tested them:

  • 2 different devices, 2 different networks
  • apllication works with added certificate pinning - connection to repositories hosted on domains above work fine, as well as obtaining from them
  • apllication works with incorrectly added certificate pinning - connection to repositories hosted on domains above does not work, so this is confirms the fact the changes have effect on app functionality

It is possible to obtain certificate pubkey hashes in two ways I know:

openssl x509 -in /path/to/intermidiate-ca-cert.pem -pubkey -noout | \
openssl pkey -pubin -outform DER | \
openssl dgst -sha256 -binary | \
openssl base64

The faster these changes are in the release version the better for users :)

@flexxxxer flexxxxer mentioned this pull request Nov 15, 2025
@flexxxxer flexxxxer changed the title add cert pinning for nine 9 f-droid repositories add cert pinning for nine f-droid repositories Nov 15, 2025
@Iamlooker Iamlooker merged commit 91a3ec9 into Droid-ify:main Nov 21, 2025
@Iamlooker
Copy link
Copy Markdown
Member

Thanks for PR

@flexxxxer
Copy link
Copy Markdown
Contributor Author

for future reference: this PR is part of planned harm-reduction caused by changes in #68 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants