Hacking a Bank by Finding a 0day in DotCMS
An unauthenticated arbitrary file upload vulnerability in dotCMS allowed writing files to any directory on the server. An attacker could upload a JSP shell to a web-accessible directory to achieve remote code execution, though in the tested bank environment the webroot was not writable, so the impact was limited to replacing existing JavaScript files.
Published on blog.assetnote.io
The advisory for this issue can be found here.
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
The application used a user-supplied filename directly when constructing the destination path for an uploaded file, without sanitising path traversal sequences.
Impact
An attacker could write arbitrary files to the server, potentially leading to remote code execution if a web-accessible directory is writable; in the tested bank environment, the webroot was not writable, so the impact was limited to replacing existing JavaScript files.
What the attacker needed
DotCMS with default configuration; no authentication required; network access to the dotCMS instance
The fix
The vulnerability was fixed by dotCMS, as indicated in their advisory.
How it was found
- Identify the unauthenticated multipart upload endpoint at /api/content/.
- Craft a multipart POST request with a filename containing directory traversal sequences to target a writable directory.
- Upload a JSP shell to a web-accessible directory to achieve remote code execution.
- In the bank environment, enumerate writable directories by observing response codes and sizes.
- Use /proc/self/cwd/../webapps/ROOT/html/ to locate the webroot, but find it not writable.
- Replace an existing JavaScript file by deriving its local path from its E-Tag value.
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.
This is about a content management system called dotCMS that had a flaw in how it handled file uploads. The software took the filename from the upload request and used it directly to save the file, without checking if the name contained path tricks like '../' to escape the intended folder. That meant an attacker could write files anywhere on the server, and if they could write to a folder that the web server serves, they could run their own code.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.