Cloudflare Bypass via Real IP Leading to Remote Code Execution (RCE)
The origin server behind Cloudflare was reachable directly by its real IP, exposing an internal documentation portal with default credentials and an unrestricted file upload. An attacker could log in, upload a PHP file, and execute it to gain remote code execution on the server.
Published on medium.com
Cloudflare is widely used to protect web applications against attacks such as XSS, SQL injection, and DDoS. It acts as a reverse proxy, filtering malicious traffic before it reaches the origin server.
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 the origin server accepted direct public connections and hosted an internal service with default credentials and an upload feature that did not restrict executable file types.
Impact
An attacker could bypass Cloudflare protections, log in to an internal portal with default credentials, and upload and execute a PHP file, achieving remote code execution on the server.
What the attacker needed
Origin server reachable by real IP; internal service exposed on open port; default credentials accepted; file upload without validation
The fix
The origin server should be restricted to accept traffic only from Cloudflare IP ranges, default credentials should be changed, and file uploads should validate file types and disable execution in upload directories.
How it was found
- Attempt XSS and SQL injection through the domain; all requests were blocked by Cloudflare.
- Use Shodan to find a potential real IP address of the target server.
- Enter the IP and required port in the browser; it redirected to the original website, confirming the origin server.
- Run an Nmap scan on the origin IP, which revealed an open port exposing a documentation portal not visible on the main application.
- Access the documentation portal and log in using default credentials.
- Use the portal's file upload to upload a malicious PHP file, trigger it in the browser, and establish a reverse shell.
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.
A website often hides its real server behind a protective service like Cloudflare, which filters bad traffic. Here, the real server could still be reached directly, skipping that protection. The hidden server had a login page with a default username and password, and its file upload let someone put a program on the server and run it, taking control.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.