Introducing MavenGate: a supply chain attack method for Java and Android applications
The article describes a supply chain attack method where abandoned Maven dependencies whose groupId domains have lapsed can be hijacked by buying the domain and re-publishing malicious artifacts. An attacker could then inject code into Java and Android applications that depend on those libraries, or into build plugins.
Published on blog.oversecured.com
Introduction
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Oversecured is a security company that builds vulnerability protection for iOS and Android apps, integrated into the CI/CD process. This research looks at the dependency resolution model used by Maven and by everything built on it, including Gradle, and asks whether an attacker can hijack a dependency and inject code into the applications that consume it. The write-up calls the resulting attack method MavenGate.
A Gradle-based project declares two things in its build configuration:
-
Dependency repositories, such as
google(),mavenCentral(),jcenter(), and others reachable via direct links. These tell the builder where to look for dependencies.
dependency_repositories From the original on blog.oversecured.com -
Dependencies, usually in the format
groupId:artifactId:version, for examplecom.google.code.gson:gson:2.10.1. The builder walks the list of repositories in order and looks for the dependency in each one.
dependencies From the original on blog.oversecured.com
Repositories come in two kinds. Private repositories, such as the Google repository, only host dependencies created and maintained by that company. Public repositories, such as mavenCentral(), accept projects and libraries from anyone.
The identity check that is supposed to prevent substitution is domain based. To publish under com.google.code.gson, you have to create a DNS TXT record for gson.code.google.com. Both Maven Central and JitPack document this ownership verification, and it is what stops one developer from publishing artifacts under another developer's groupId.
Setup
The researchers deliberately avoided testing against real dependencies, because that could break other developers' CI/CD builds and inject test code into their projects. All experiments used the groupId com.oversecured, and the mavenCentral and jitpack repositories, to understand how each one onboards new projects.
The test artifact was an Android library called hello-world that outputs Hello world!:

Finding it
The ownership check depends entirely on the ability to add DNS records for a domain. The question the researchers asked is what happens when a developer abandons a project and does not renew the domain registration. If the domain lapses, anyone can buy it, create the TXT record, and claim the groupId that the original developer still publishes under.
The attack strategy they laid out:
- Search for abandoned dependencies that are already in known repositories.
- Buy the corresponding domain.
- Gain control of the
groupId, in one of two ways:- In most cases a developer publishes artifacts to only one repository. Dependencies are searched and downloaded in the order the repositories are declared, although Android Studio suggests upgrading to the newest version and warns when new versions exist. An attacker can claim a vulnerable
groupIdby asserting rights to it via a DNS TXT record in a repository where no account managing thatgroupIdexists yet. - If the
groupIdis already registered with the repository, the attacker can try to get access by contacting the repository's support team, arguing from domain ownership or an official email account on that domain. The report notes there is no information about how permission transfers for agroupIdare handled, and that procedures may differ between repositories because there is no common standard.
- In most cases a developer publishes artifacts to only one repository. Dependencies are searched and downloaded in the order the repositories are declared, although Android Studio suggests upgrading to the newest version and warns when new versions exist. An attacker can claim a vulnerable
Exploitation
Step 1: publish to Maven Central
The com.oversecured:hello-world:1.0 dependency was uploaded to mavenCentral(). The process:
-
Claiming the
groupId, which required creating a DNS TXT record with a randomly generated value. Confirmation took a few seconds.
mavencentral_verified From the original on blog.oversecured.com -
Creating a deployment via Android Studio and uploading it.

mavencentral_deployment From the original on blog.oversecured.com -
The dependency became available at
https://repo.maven.apache.org/maven2/com/oversecured/hello-world/.
mavencentral_repository From the original on blog.oversecured.com -
With default Android project settings, it also became available in Android Studio.

android_studio_repositories From the original on blog.oversecured.com 
android_studio_dependency
Step 2: publish to JitPack
The same dependency was then uploaded to the jitpack repository with versions 1.0 and 1.1. Version 1.0 was a copy of what went to mavenCentral(); 1.1 was an edited copy. The process:
-
Binding the
jitpackaccount to the test GitHub repository. -
Granting access to private GitHub repositories.
-
Claiming the
com.oversecuredgroupIdby adding a DNS TXT record that references the GitHub username.
jitpack_dns_txt From the original on blog.oversecured.com -
Submitting version
1.0to the repository.
jitpack_1.0 From the original on blog.oversecured.com -
Changing the code and submitting version
1.1. The versions were also made available athttps://jitpack.io/com/oversecured/hello-world/1.1/.
hello-world_1.1 From the original on blog.oversecured.com 
jitpack_1.1
Step 3: observe resolution behaviour
After https://jitpack.io was added to the list of repositories for Gradle:

Android Studio started urging an update of the hello-world library:

The results:
- When the
jitpackrepository was moved abovemavenCentral, version1.0was downloaded fromjitpack. - Changing the library version to
1.1resulted in thejitpackversion being used regardless of wherejitpacksat in the repository list.
The second result shows the jitpack version was used regardless of its position in the repository list.
Attack vectors
Against web and mobile applications:
- Attack against existing versions. If the attacker's repository is higher in the project's list than the legitimate one, the attacker can serve existing copies of the library with embedded malicious code. With default settings, most libraries are vulnerable to this.
- Attack against new versions. As demonstrated, the attack also works when the attacker's repository is lower in the list. Most applications do not check the digital signature of dependencies, and many libraries do not publish one. An attacker who wants to stay undetected releases a new version with the malicious code and waits for the developer to upgrade.
Against libraries:
- The library's
groupIdshould be checked for hijackability, because projects using it may be vulnerable. - A library's dependencies are not resolved inside the library but in the project that uses it. They become transitive dependencies of that project and are searched according to that project's repository declarations.
Root cause
The trust model for a groupId is a DNS record on a domain the developer may stop paying for. Once the domain lapses, the identity check can be satisfied by whoever buys it. The default build configuration validates nothing: no hash, no signature, no key. Repository ordering decides which artifact wins when versions match, and a newer version elsewhere overrides ordering.
Existing defences are limited to two options for Gradle projects:
- Checking hash sums of files injected into the project. This works while the developer does not update the library version, but on update it does not protect against artifact spoofing at all. The report compares it to using static
jarlibraries in alibsfolder. - Checking digital signatures of dependencies via
.ascfiles. Many repositories request these files on publish, but there is no efficient way to verify them. The dependency must publish its public key in advance and the consumer must list it ingradle/verification-metadata.xml. This is the best existing defence, but few dependencies document their key. A developer can load thefileandfile.ascfiles and run:
gpg --verify file.asc
With no public key this always errors, but it prints the keyid. The key can then be looked up:
gpg --keyserver keyserver.ubuntu.com --recv-keys {key_value}
Other public repositories named are keys.openpgp.org and pgp.mit.edu. The mavenCentral documentation states that publishing the public key is mandatory, yet during testing the researchers successfully uploaded a signed dependency without publishing a public key and used it in their application.
Measuring the problem
To size the issue, the researchers recommend running:
./gradlew --write-verification-metadata pgp,sha256 --export-keys
This creates gradle/verification-metadata.xml to validate the public keys of current dependencies. Running it surfaced a large number of unsigned dependencies from Google:

Checking numerous dependencies in Google's official repository showed that they do not sign any artifacts at all. Google was contacted and a response was pending at publication. Many Apache dependencies also failed validation because Gradle could not find their public key on any server, probably because it was never published:

For scale, the researchers took all groupId values from mavenCentral, the largest and default repository for Android and many Java projects, converted them to domains, and checked whether those domains could be bought or auctioned using the GoDaddy Bulk Domain Search tool. GoDaddy does not register some national domains, so those were checked through national registrars.
| Set | Total | Vulnerable | Share |
|---|---|---|---|
Maven Central domains (MavenCentral_all.txt) |
26,163 | 3,710 (MavenCentral_vulnerable.txt) |
14.18% |
GitHub projects, io.github.* (MavenCentral_github_all.txt) |
7,523 | 291 (MavenCentral_github_vulnerable.txt) |
3.86% |
Combined, including private repositories found (all.txt) |
33,938 | 6,170 (vulnerable.txt) |
18.18% |
The GitHub case matters because many public repositories, including mavenCentral, let private developers use their GitHub accounts, and a changed username becomes available for registration.
The researchers argued that publishing the lists is ethical and necessary: anyone could produce them with a few simple scripts, they help library developers find out whether their project is vulnerable and dependency users check their dependencies, and registering a domain or GitHub account from the list and publishing artifacts under it should alert the community.
Top 20 abandoned and vulnerable dependencies by share among the vulnerable set:
| Group ID | % (among vulnerable) |
|---|---|
| co.fs2 | 10.6305 |
| net.jpountz.lz4 | 4.2146 |
| org.mvel | 3.6001 |
| org.tpolecat | 3.288 |
| com.opencsv | 3.1148 |
| io.repaint.maven | 2.3336 |
| com.coderplus.maven.plugins | 2.3042 |
| com.agilejava.docbkx | 1.9839 |
| org.scalaj | 1.8499 |
| org.picketbox | 1.5558 |
| io.argonaut | 1.5231 |
| org.spire-math | 1.4152 |
| com.boundary | 1.273 |
| org.tmatesoft.svnkit | 1.1636 |
| org.cassandraunit | 1.1292 |
| org.ini4j | 0.9887 |
| tk.mybatis | 0.9004 |
| com.keyboardsamurais.maven | 0.8024 |
| org.derive4j | 0.7877 |
Impact
More than 18% of dependencies can be intercepted by attackers, which for a typical project with many direct and transitive dependencies sharply raises the probability of a vulnerable path. Reports went to over 200 companies, including Google, Facebook, Signal and Amazon, and disclosures were sent to Google, Facebook, Amazon, Microsoft, Adobe, LinkedIn, Netflix and over two hundred other companies. If exploited, an attacker can inject code into an application by attacking its dependencies, and can also inject into the build process and reach a company's infrastructure through a plugin attack.
The researchers checked popular open-source Android applications and the POM files of publicly distributed and open-source libraries, and found many Android and Java projects affected. They could not give concrete examples at publication because disclosure had not been coordinated with high-profile companies or fixes were not yet in place.
Fix
Recommendations from Oversecured, by audience:
- All developers: make sure there are no abandoned direct or transitive dependencies whose domain an attacker could buy and then re-release existing versions or publish only new ones. Generate a
verification-metadata.xmlfile and update it gradually as dependency developers fix their signing or key distribution. Make sure every repository in use is trusted. - Library developers: make sure the project domain does not expire or get bought out, and that all versions are properly signed with the key available on one of the listed servers.
- Repositories: consider requiring library developers to configure deployment properly and refusing incorrectly configured releases.
- Security researchers: check open-source libraries, notify repositories and affected developers, and look for existing attacks by checking artifact signatures across all versions and all public repositories where possible.
- The whole community: the PGP signing system is probably outdated because it adds a step of uploading the public key to third-party services, and it is centralised enough that the three key servers going offline could break many builds. The proposal is to upload the public key alongside the artifacts so the author can be verified regardless of repository, to declare a public key hash in the dependency declaration, for example
implementation 'groupId:artifactId:version:sha256signature', and to shift responsibility so library developers answer for the dependencies they declare and the end developer only for direct dependencies.
Timeline
- 01/19. Sonatype, owner of
mavenCentral, published a comment. Oversecured assisted in blocking vulnerable dependencies and in finding bugs around the lack of public key verification of uploaded artifacts. - 02/23. Oversecured noted that Sonatype's comment confused some readers, and clarified that Sonatype has not fixed the vulnerability and cannot, because the attack becomes possible when multiple public repositories are used. If an abandoned dependency is uploaded to JCenter but Maven Central is first in the list, hijacking is still possible through Maven Central. The only thing a public repository owner can do is prohibit automatic claiming of vulnerable
groupIdvalues.
Variants to test
- Enumerate
groupIdvalues from a public repository, convert them to domains, and check registration status in bulk. A positive result is a domain that is expired or purchasable while itsgroupIdstill has published artifacts. - Check
io.github.*coordinates against GitHub username availability. A positive result is a username that can be registered while artifacts under that namespace remain published. - Add a second repository ahead of the legitimate one and request an existing version. A positive result is the artifact being fetched from the attacker-controlled repository.
- Publish a higher version number in a lower-priority repository and let the IDE offer the upgrade. A positive result is the higher version being selected regardless of repository order.
- Run the verification metadata export against a target project and inspect which dependencies lack signatures or resolvable public keys. A positive result is unsigned artifacts, or signed artifacts whose key cannot be found on any key server.
- For a library you depend on, check whether its own declared dependencies resolve through your project's repository list rather than the library's. A positive result is a transitive dependency that can be satisfied from an attacker-controlled repository you have configured.
What happened, in plain words
Oversecured is a security company that builds tools to protect iOS and Android apps. Their tools plug into the process developers use to build and release apps, and they check the code for security problems before it reaches users. This article describes research they did into a way an attacker could slip malicious code into a huge number of Java and Android apps without ever touching the app's own code. They call the method MavenGate.
The idea is simple once you know how apps are built. Almost no app is written entirely from scratch. Developers reuse chunks of ready-made code called libraries or dependencies, the same way a cook might buy a ready-made sauce instead of making it from scratch. When the app is built, a tool called Gradle (think of it as the kitchen assistant) goes and fetches those libraries from online storage places called repositories (think of them as supermarkets for code).
The problem Oversecured found is that the supermarket does not always check very carefully who is selling what. If the original author of a library stops paying for their website address (their domain), someone else can buy that address, prove to the supermarket that they now own it, and start selling a tampered version of the same library under the same name. Every app that uses that library then quietly picks up the attacker's code the next time it is built.
Oversecured tested this on their own name, not on anyone else's, and then measured how widespread the problem is. They found that more than 18% of dependencies could be intercepted this way. They sent reports to over 200 companies, including Google, Facebook, Signal, Amazon, Microsoft, Adobe, LinkedIn and Netflix.
Some background first: how a Gradle project is put together
Before the attack makes sense, you need to know what a Gradle project actually contains. A Gradle-based project declares two things in its build configuration.
1. Where to look: the repositories
The first thing a project declares is a list of dependency repositories, such as google(), mavenCentral(), jcenter(), and others reachable via direct links. These tell the builder where to look for dependencies.

A repository is just a website that stores library files and lets a build tool download them. The image shows the list of repositories as it appears in a project's configuration. The order of this list matters, and that becomes the heart of the attack later on.
2. What to fetch: the dependencies
The second thing a project declares is its dependencies, usually written in the format groupId:artifactId:version, for example com.google.code.gson:gson:2.10.1. The builder walks the list of repositories in order and looks for the dependency in each one.

That three-part name is worth unpacking, because every part matters for the attack:
- groupId is the namespace, usually written backwards from a domain name.
com.google.code.gsonbelongs to Google because Google ownsgoogle.com. This is the part an attacker tries to steal. - artifactId is the name of the specific library, here
gson. - version is the release number, here
2.10.1. Higher numbers are treated as newer.
The image shows a dependency declaration in a build file. The builder reads this line, then goes shopping in the repositories from the first list, in order, until it finds a match.
Private versus public repositories
Repositories come in two kinds.
- Private repositories, such as the Google repository, only host dependencies created and maintained by that company. Think of a staff-only warehouse: only Google's own products go in.
- Public repositories, such as
mavenCentral(), accept projects and libraries from anyone. Think of a public market stall: anyone can rent a spot and sell.
The attack lives entirely in the public ones.
The identity check: DNS TXT records
The obvious question is: what stops one developer from publishing code under another developer's name in a public repository? The answer is a domain-based identity check.
To publish under com.google.code.gson, you have to create a DNS TXT record for gson.code.google.com. Both Maven Central and JitPack document this ownership verification, and it is what stops one developer from publishing artifacts under another developer's groupId.
Two terms to explain here:
- DNS is the internet's address book. It translates names like
google.cominto the numeric addresses computers use. Only the person who controls a domain can edit its DNS entries. - A TXT record is a small piece of free text you can attach to a domain in that address book. Because only the domain's owner can add one, a repository can ask you to put a specific random string there. If the string appears, you must control the domain.
So the check is: "prove you own the domain that matches your groupId by putting our random code in its DNS entry." That is a reasonable check, as long as you keep owning the domain.
Setting up the experiment
The researchers deliberately avoided testing against real dependencies, because that could break other developers' CI/CD builds and inject test code into their projects. CI/CD stands for continuous integration and continuous delivery: the automated pipeline that builds, tests and ships software every time a developer saves a change. Breaking someone else's pipeline would be like tampering with a factory production line you do not own.
All experiments used the groupId com.oversecured, which the company itself owns, and the mavenCentral and jitpack repositories, to understand how each one onboards new projects.
The test artifact was an Android library called hello-world that outputs Hello world!:

The image shows the tiny library's source. It does nothing except print a greeting. That is the point: the researchers wanted a harmless, obviously fake library so that if anything went wrong, nobody's real software would be affected.
Finding the weakness
The ownership check depends entirely on the ability to add DNS records for a domain. The question the researchers asked is what happens when a developer abandons a project and does not renew the domain registration. If the domain lapses, anyone can buy it, create the TXT record, and claim the groupId that the original developer still publishes under.
Think of it like a shop that has been closed for years but whose sign is still up. If the lease on the shop expires and someone else rents it, they can put their own goods on the shelves under the old shop's name, and regular customers will not notice.
The attack strategy they laid out:
- Search for abandoned dependencies that are already in known repositories.
- Buy the corresponding domain.
- Gain control of the
groupId, in one of two ways:- In most cases a developer publishes artifacts to only one repository. Dependencies are searched and downloaded in the order the repositories are declared, although Android Studio suggests upgrading to the newest version and warns when new versions exist. An attacker can claim a vulnerable
groupIdby asserting rights to it via a DNS TXT record in a repository where no account managing thatgroupIdexists yet. - If the
groupIdis already registered with the repository, the attacker can try to get access by contacting the repository's support team, arguing from domain ownership or an official email account on that domain. The report notes there is no information about how permission transfers for agroupIdare handled, and that procedures may differ between repositories because there is no common standard.
- In most cases a developer publishes artifacts to only one repository. Dependencies are searched and downloaded in the order the repositories are declared, although Android Studio suggests upgrading to the newest version and warns when new versions exist. An attacker can claim a vulnerable
Android Studio is the program developers use to write Android apps. It is the friendly face on top of Gradle: it shows the project, offers to update libraries, and warns when newer versions exist. That helpful behaviour becomes part of the attack later.
Carrying out the attack
Step 1: publish to Maven Central
The com.oversecured:hello-world:1.0 dependency was uploaded to mavenCentral(). The process:
-
Claiming the
groupId, which required creating a DNS TXT record with a randomly generated value. Confirmation took a few seconds.
mavencentral_verified From the original on blog.oversecured.com The image shows the repository's confirmation screen after the DNS record was added. The random value is the proof: only someone who can edit the domain's DNS can make that exact string appear.
-
Creating a deployment via Android Studio and uploading it.

mavencentral_deployment From the original on blog.oversecured.com The image shows the upload step inside Android Studio. A deployment here just means packaging the library and sending it to the repository.
-
The dependency became available at
https://repo.maven.apache.org/maven2/com/oversecured/hello-world/.
mavencentral_repository From the original on blog.oversecured.com The image shows the library now listed on the public repository. Anyone in the world can now download it from that address.
-
With default Android project settings, it also became available in Android Studio.

android_studio_repositories From the original on blog.oversecured.com 
android_studio_dependency These images show the library appearing inside Android Studio's own dependency browser. Default settings matter: a developer who never changes anything gets this behaviour automatically, without choosing it.
Step 2: publish to JitPack
The same dependency was then uploaded to the jitpack repository with versions 1.0 and 1.1. Version 1.0 was a copy of what went to mavenCentral(); 1.1 was an edited copy. The process:
-
Binding the
jitpackaccount to the test GitHub repository. -
Granting access to private GitHub repositories.
-
Claiming the
com.oversecuredgroupIdby adding a DNS TXT record that references the GitHub username.
jitpack_dns_txt From the original on blog.oversecured.com The image shows the DNS record used for JitPack. JitPack works slightly differently from Maven Central: it builds libraries straight from GitHub, so its ownership check ties the groupId to a GitHub account rather than only to a domain.
-
Submitting version
1.0to the repository.
jitpack_1.0 From the original on blog.oversecured.com The image shows version
1.0accepted. At this point JitPack holds an exact copy of the legitimate library. -
Changing the code and submitting version
1.1. The versions were also made available athttps://jitpack.io/com/oversecured/hello-world/1.1/.
hello-world_1.1 From the original on blog.oversecured.com 
jitpack_1.1 These images show the edited version
1.1published. This is the malicious version in a real attack: same name, same groupId, higher version number, different code.
Step 3: watch what the build tool does
After https://jitpack.io was added to the list of repositories for Gradle:

The image shows the repository list with JitPack added. This is exactly what a developer might do after reading a tutorial that says "add JitPack to your repositories".
Android Studio started urging an update of the hello-world library:

The image shows Android Studio's update prompt. The editor is helpfully telling the developer that a newer version exists. In a real attack, that prompt is the attacker's best friend: it invites the developer to switch to the malicious version.
The results:
- When the
jitpackrepository was moved abovemavenCentral, version1.0was downloaded fromjitpack. - Changing the library version to
1.1resulted in thejitpackversion being used regardless of wherejitpacksat in the repository list.
The second result shows the jitpack version was used regardless of its position in the repository list.
Attack vectors
An attack vector is simply the route an attacker takes to reach their goal. There are different routes depending on what is being attacked.
Against web and mobile applications:
- Attack against existing versions. If the attacker's repository is higher in the project's list than the legitimate one, the attacker can serve existing copies of the library with embedded malicious code. With default settings, most libraries are vulnerable to this.
- Attack against new versions. As demonstrated, the attack also works when the attacker's repository is lower in the list. Most applications do not check the digital signature of dependencies, and many libraries do not publish one. An attacker who wants to stay undetected releases a new version with the malicious code and waits for the developer to upgrade.
A digital signature is a cryptographic stamp that proves a file really came from its claimed author and has not been altered. Checking it is like checking a wax seal on a letter. Most builds here do not check the seal at all.
Against libraries:
- The library's
groupIdshould be checked for hijackability, because projects using it may be vulnerable. - A library's dependencies are not resolved inside the library but in the project that uses it. They become transitive dependencies of that project and are searched according to that project's repository declarations.
A transitive dependency is a dependency of a dependency. If you use library A, and library A uses library B, then B arrives in your project without you ever naming it. You are still responsible for it, and it is still fetched using your repository list.
Root cause
The trust model for a groupId is a DNS record on a domain the developer may stop paying for. Once the domain lapses, the identity check can be satisfied by whoever buys it. The default build configuration validates nothing: no hash, no signature, no key. Repository ordering is the only thing that decides which artifact wins, and version comparison overrides ordering when a newer version exists elsewhere.
A hash is a short fingerprint computed from a file's contents. If the file changes even slightly, the fingerprint changes. Checking a hash is a cheap way to notice tampering, but only if you already know the correct fingerprint in advance.
Existing defences are limited to two options for Gradle projects:
- Checking hash sums of files injected into the project. This works while the developer does not update the library version, but on update it does not protect against artifact spoofing at all. The report compares it to using static
jarlibraries in alibsfolder. - Checking digital signatures of dependencies via
.ascfiles. Many repositories request these files on publish, but there is no efficient way to verify them. The dependency must publish its public key in advance and the consumer must list it ingradle/verification-metadata.xml. This is the best existing defence, but few dependencies document their key.
A public key is the half of a cryptographic key pair that you share openly so others can check your signatures. The matching private key stays secret and is used to create the signature. If you cannot find someone's public key, you cannot check their signature.
A developer can load the file and file.asc files and run:
gpg --verify file.asc
gpg is a free program for working with cryptographic signatures. This command asks it to check the signature file file.asc against the file it signs. With no public key this always errors, but it prints the keyid, a short identifier for the key that made the signature. The key can then be looked up:
gpg --keyserver keyserver.ubuntu.com --recv-keys {key_value}
This command asks a key server (a public directory of public keys) to send back the key with the given identifier. Other public repositories named are keys.openpgp.org and pgp.mit.edu. The mavenCentral documentation states that publishing the public key is mandatory, yet during testing the researchers successfully uploaded a signed dependency without publishing a public key and used it in their application.
Measuring the problem
To size the issue, the researchers recommend running:
./gradlew --write-verification-metadata pgp,sha256 --export-keys
This creates gradle/verification-metadata.xml to validate the public keys of current dependencies. In plain terms, it walks through every library the project uses, records a fingerprint (sha256) and any signature information (pgp) it can find, and writes the result to a file. Running it surfaced a large number of unsigned dependencies from Google:

The image relates to the large number of unsigned dependencies from Google that the researchers noticed.
Checking numerous dependencies in Google's official repository showed that they do not sign any artifacts at all. Google was contacted and a response was pending at publication. Many Apache dependencies also failed validation because Gradle could not find their public key on any server, probably because it was never published:

The image relates to Apache dependencies that failed validation because Gradle did not find their public key on any server.
For scale, the researchers took all groupId values from mavenCentral, the largest and default repository for Android and many Java projects, converted them to domains, and checked whether those domains could be bought or auctioned using the GoDaddy Bulk Domain Search tool. GoDaddy does not register some national domains, so those were checked through national registrars.
| Set | Total | Vulnerable | Share |
|---|---|---|---|
Maven Central domains (MavenCentral_all.txt) |
26,163 | 3,710 (MavenCentral_vulnerable.txt) |
14.18% |
GitHub projects, io.github.* (MavenCentral_github_all.txt) |
7,523 | 291 (MavenCentral_github_vulnerable.txt) |
3.86% |
Combined, including private repositories found (all.txt) |
33,938 | 6,170 (vulnerable.txt) |
18.18% |
The GitHub case matters because many public repositories, including mavenCentral, let private developers use their GitHub accounts, and a changed username becomes available for registration. In other words, if a developer renames their GitHub account, the old name is up for grabs, and any library published under io.github.oldname can be claimed by whoever takes it.
The researchers argued that publishing the lists is ethical and necessary: anyone could produce them with a few simple scripts, they help library developers find out whether their project is vulnerable and dependency users check their dependencies, and registering a domain or GitHub account from the list and publishing artifacts under it should alert the community.
Top 20 abandoned and vulnerable dependencies by share among the vulnerable set:
| Group ID | % (among vulnerable) |
|---|---|
| co.fs2 | 10.6305 |
| net.jpountz.lz4 | 4.2146 |
| org.mvel | 3.6001 |
| org.tpolecat | 3.288 |
| com.opencsv | 3.1148 |
| io.repaint.maven | 2.3336 |
| com.coderplus.maven.plugins | 2.3042 |
| com.agilejava.docbkx | 1.9839 |
| org.scalaj | 1.8499 |
| org.picketbox | 1.5558 |
| io.argonaut | 1.5231 |
| org.spire-math | 1.4152 |
| com.boundary | 1.273 |
| org.tmatesoft.svnkit | 1.1636 |
| org.cassandraunit | 1.1292 |
| org.ini4j | 0.9887 |
| tk.mybatis | 0.9004 |
| com.keyboardsamurais.maven | 0.8024 |
| org.derive4j | 0.7877 |
Impact
More than 18% of dependencies can be intercepted by attackers, which for a typical project with many direct and transitive dependencies sharply raises the probability of a vulnerable path. Reports went to over 200 companies, including Google, Facebook, Signal and Amazon, and disclosures were sent to Google, Facebook, Amazon, Microsoft, Adobe, LinkedIn, Netflix and over two hundred other companies. If exploited, an attacker can inject code into an application by attacking its dependencies, and can also inject into the build process and reach a company's infrastructure through a plugin attack.
A plugin is a piece of code that runs inside the build tool itself, not inside the finished app. A plugin attack is therefore different from a library attack: the malicious code runs inside the build tool, and the report notes it can give access to a company's infrastructure.
The researchers checked popular open-source Android applications and the POM files of publicly distributed and open-source libraries, and found many Android and Java projects affected. A POM file is the configuration file that describes a library's own dependencies. They could not give concrete examples at publication because disclosure had not been coordinated with high-profile companies or fixes were not yet in place.
Fix
Recommendations from Oversecured, by audience:
- All developers: make sure there are no abandoned direct or transitive dependencies whose domain an attacker could buy and then re-release existing versions or publish only new ones. Generate a
verification-metadata.xmlfile and update it gradually as dependency developers fix their signing or key distribution. Make sure every repository in use is trusted. - Library developers: make sure the project domain does not expire or get bought out, and that all versions are properly signed with the key available on one of the listed servers.
- Repositories: consider requiring library developers to configure deployment properly and refusing incorrectly configured releases.
- Security researchers: check open-source libraries, notify repositories and affected developers, and look for existing attacks by checking artifact signatures across all versions and all public repositories where possible.
- The whole community: the PGP signing system is probably outdated because it adds a step of uploading the public key to third-party services, and it is centralised enough that the three key servers going offline could break many builds. The proposal is to upload the public key alongside the artifacts so the author can be verified regardless of repository, to declare a public key hash in the dependency declaration, for example
implementation 'groupId:artifactId:version:sha256signature', and to shift responsibility so library developers answer for the dependencies they declare and the end developer only for direct dependencies.
PGP is the family of tools behind those .asc signature files. It relies on public key servers, which is why the researchers call it centralised: if those servers are unavailable, verification stops working.
Timeline
- 01/19. Sonatype, owner of
mavenCentral, published a comment. Oversecured assisted in blocking vulnerable dependencies and in finding bugs around the lack of public key verification of uploaded artifacts. - 02/23. Oversecured noted that Sonatype's comment confused some readers, and clarified that Sonatype has not fixed the vulnerability and cannot, because the attack becomes possible when multiple public repositories are used. If an abandoned dependency is uploaded to JCenter but Maven Central is first in the list, hijacking is still possible through Maven Central. The only thing a public repository owner can do is prohibit automatic claiming of vulnerable
groupIdvalues.
Variants to test
If you want to reproduce or extend this work, these are the checks the researchers describe:
- Enumerate
groupIdvalues from a public repository, convert them to domains, and check registration status in bulk. A positive result is a domain that is expired or purchasable while itsgroupIdstill has published artifacts. - Check
io.github.*coordinates against GitHub username availability. A positive result is a username that can be registered while artifacts under that namespace remain published. - Add a second repository ahead of the legitimate one and request an existing version. A positive result is the artifact being fetched from the attacker-controlled repository.
- Publish a higher version number in a lower-priority repository and let the IDE offer the upgrade. A positive result is the higher version being selected regardless of repository order.
- Run the verification metadata export against a target project and inspect which dependencies lack signatures or resolvable public keys. A positive result is unsigned artifacts, or signed artifacts whose key cannot be found on any key server.
- For a library you depend on, check whether its own declared dependencies resolve through your project's repository list rather than the library's. A positive result is a transitive dependency that can be satisfied from an attacker-controlled repository you have configured.
Glossary
- Android Studio: the program developers use to write Android apps; it manages Gradle projects and offers library updates.
- Artifact: a packaged file (a library, a plugin, a jar) published to a repository.
- Attack vector: the route an attacker takes to reach their goal.
- CI/CD: continuous integration and continuous delivery; the automated pipeline that builds, tests and ships software.
- Dependency: a ready-made piece of code that a project reuses instead of writing it itself.
- Deployment: packaging a library and sending it to a repository.
- Digital signature: a cryptographic stamp proving a file came from its claimed author and was not altered.
- DNS: the internet's address book, mapping names like
google.comto numeric addresses. - Domain: a website address such as
google.com; whoever controls it controls its DNS entries. - Gradle: the build tool that reads a project's configuration and fetches its dependencies.
- groupId: the namespace part of a dependency name, usually a reversed domain, e.g.
com.google.code.gson. - Hash: a short fingerprint computed from a file's contents; any change to the file changes the fingerprint.
- JitPack: a public repository that builds libraries directly from GitHub.
- Key server: a public directory of public keys, such as
keyserver.ubuntu.com,keys.openpgp.organdpgp.mit.edu. - Library: a reusable chunk of code published for others to depend on.
- Maven Central: the largest and default public repository for Android and many Java projects, owned by Sonatype.
- MavenGate: the name Oversecured gives to this dependency-hijacking attack method.
- PGP: a family of tools for creating and checking cryptographic signatures, relying on public key servers.
- Plugin: code that runs inside the build tool itself rather than inside the finished app.
- POM file: the configuration file describing a library's own dependencies.
- Private repository: a repository that only hosts dependencies from its own company, such as Google's.
- Public key: the openly shared half of a cryptographic key pair, used to check signatures.
- Public repository: a repository that accepts libraries from anyone, such as Maven Central.
- Repository: an online storage place that hosts library files for build tools to download.
- Sonatype: the company that owns Maven Central.
- Transitive dependency: a dependency of a dependency, arriving in a project without being named directly.
- TXT record: a small piece of free text attached to a domain in DNS, used here to prove domain ownership.
- Version: the release number of a library; higher numbers are treated as newer.