Sonatype Nexus Repository Manager

Sonatype Nexus Repository Manager often exposes useful version details and REST endpoints before authentication. Default credentials, low-privileged access, Groovy scripting, and older EL injection bugs can lead to command execution.

Discovery

curl -I http://TARGET:8081/
curl http://TARGET:8081/robots.txt
curl http://TARGET:8081/service/rest/swagger.json
curl http://TARGET:8081/service/rest/v1/repositories

Useful indicators:

Server: Nexus/3.x.x-xx (OSS)
Nexus Repository Manager
/repository/
/service/

Nuclei is useful for passive detection, but aggressive scans can make smaller Nexus instances unstable:

nuclei -target http://TARGET:8081 -rl 5 -c 3 -as

The main page may disclose the exact version, for example OSS 3.21.0-05.

REST Enumeration

curl http://TARGET:8081/service/rest/v1/repositories
curl http://TARGET:8081/service/rest/v1/search
curl http://TARGET:8081/service/rest/v1/search/assets
curl 'http://TARGET:8081/service/rest/v1/components?repository=REPO_NAME'

Probe repository names directly:

Response wording can distinguish a missing repository from a malformed repository path.

Default / Initial Admin Password

Nexus 3.17.0+ generates the first admin password in the data directory instead of using admin:admin123.

Common locations:

Older installs may still use:

nexus:nexus is listed in SecLists default credentials:

Check low-privileged logins too. CVE-2020-10199 style EL injection is post-authentication and may only require any valid user.

Authenticated EL Injection RCE

Nexus Repository Manager versions up to and including 3.21.1 are affected by a post-authentication Java Expression Language injection. Any authenticated user may be enough.

Metasploit module:

Public PoC references:

For Windows targets, cmd.exe payloads are often more reliable than PowerShell one-liners through this path. Confirm blind command execution with ICMP first:

If the PoC mangles Windows backslashes, URL-encode path separators:

Authenticated Groovy RCE

If scripts are enabled, use the script API or the admin UI to run Groovy. On Windows, a custom Groovy task can execute cmd.exe and spawn a callback.

Simple command execution:

Download and run a payload:

Pure Groovy reverse shell for Windows:

Windows Post-Exploitation

Check the service account and install paths from the UI or shell:

If the service binary or Nexus install directory is writable by low-privileged users, treat it as a Windows service-binary escalation path. See Windows Privilege Escalation.

Nexus may run from a user profile instead of a service-style install path:

If the process user has SeImpersonatePrivilege, pivot to Potato-style escalation. See Windows Privilege Abuse.

Last updated