[Blog] About the Unsuccessful Quest for a Deserialization Gadget (or: How I found CVE-2021-21481)
An unauthenticated remote method invocation (RMI) call to the JUpgradeIF interface allowed exporting arbitrary configuration data to a server file path. An attacker could write a ZIP archive to a web-accessible directory and download it, potentially stealing keystores to forge admin logon tickets.
code-white.com
Published on code-white.com
This blog post describes the research on SAP J2EE Engine 7.50 I did between October 2020 and January 2021. The first part describes how I set off to find a pure SAP deserialization gadget, which would allow to leverage SAP’s P4 protocol for exploitation, and how that led me, by sheer coincidence, to an entirely…
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a missing authorization check on the openCfg method of the JUpgradeIF remote interface, which allowed unauthenticated callers to export configuration data to arbitrary server paths.
Impact
An unauthenticated attacker could export configuration data to a web-accessible folder and download it, potentially obtaining the TicketKeystore to forge an Administrator logon ticket, or cause a denial of service by filling the file system.
What the attacker needed
Network access to the P4 port; no authentication required
The fix
SAP fixed the missing authorization check in March 2021, as described in SAP note 3224022.
How it was found
- Connect to the P4 port using a JNDI context without providing credentials.
- Look up the MigrationService binding to obtain a JUpgradeIF stub.
- Call openCfg with a configuration path and walk to the desired sub-configuration.
- Export the configuration to a local path on the server that is inside a web application root.
- Download the resulting archive over HTTP.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The SAP J2EE Engine has a remote administration protocol called P4. One of its functions, used for migrating configurations, could be called without logging in. It let the caller save a copy of server configuration files to any location on the server, including a folder served by the web server, so an attacker could download sensitive files like encryption keys.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.