Skip to content
RCE Write-up Advanced

How to hack a company by circumventing its WAF through the abuse of a different security appliance and win bug bounties

redtimmysec Follow

Published on redtimmy.com

Hey, wait! What do bug bounties and network security appliances have in common?

Red Timmy Security (@redtimmysec), on redtimmy.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

The target was a Fortune 500 company whose name the researchers chose not to disclose, referred to throughout as targetdomain. The company ran several applications under https://targetdomain/appname, with authentication handled by a separate subdomain, https://auth.targetdomain. The researchers also withheld the name of the vulnerable component, but described it as a Java component well known to be vulnerable to RCE, whose CSS and JavaScript resources were exposed on the authentication subdomain.

In front of the web and application servers sat at least one WAF device and a Bluecoat proxy server. The Bluecoat appliance is a web filtering proxy, and the feature that mattered here is its cfru parameter: a base64-encoded URL that, in the observed flow, carried the originally requested resource. In the normal flow, a user browsing https://targetdomain/appname is sent to https://auth.targetdomain to authenticate, and during that process is redirected to a URL carrying cfru.

Setup

No accounts, credentials or specific tooling are described. The work was done by browsing the public site and observing redirects and responses. The preconditions that made the attack possible were:

  1. A Java component on auth.targetdomain vulnerable to RCE, reachable through an endpoint taking a param parameter.
  2. A WAF rule that blocked requests whose param contained the malicious payload, returning HTTP 404.
  3. A Bluecoat proxy that accepted the cfru parameter without authentication and fetched the URL it contained, returning the content to the client instead of issuing a redirect.
  4. Outbound TCP connections from the target to the internet blocked, with DNS traffic still allowed.

Finding it

Browsing what turned out to be a valuable target, the researchers noticed that the authentication subdomain exposed CSS and JavaScript resources attributable to the vulnerable Java component. Requesting the affected endpoint directly, in the form https://auth.targetdomain/vulnerable_endpoint?param=malicious_RCE_payload, returned HTTP 404. That was suspicious: if the endpoint were genuinely absent, the resources decorating it would not be reachable either. A few more requests were all blocked, confirming that a WAF rule was preventing access to the endpoint.

While authenticating to an application at https://targetdomain/appname, the researchers were redirected to https://auth.targetdomain and then to a URL of this shape:

Text
https//targetdomain/?cfru=[redacted]==

Decoding the base64 string [redacted]== gave https://targetdomain/appname, the URL originally requested before authentication. Research identified cfru as part of Bluecoat web filtering technology, which revealed part of the remote infrastructure: requests crossed at least one WAF and a Bluecoat proxy before reaching the front end and application servers.

From the original on redtimmy.com

The diagram reconstructs the request path described above.

Exploitation

Step 1: probing the cfru parameter for SSRF

The cfru parameter was publicly accessible: no authentication to the portal was required to pass a payload to it. The researchers base64-encoded URLs of external domains under their control and fed them into cfru, hoping to trigger an SSRF. No HTTP requests came back, but on their internet-exposed machines they saw DNS resolution attempts originating from targetdomain. Outgoing TCP connections from the target were prohibited; only DNS traffic was authorised.

Step 2: switching to internal subdomains

Instead of external hosts, the researchers encoded internal subdomains such as https://auth.targetdomain, https://blog.targetdomain and https://www.targetdomain. The behaviour differed by URL: some produced an HTTP 302 redirect, others did not. For the latter, the HTTP body contained the HTML of the requested resource, as if Bluecoat had forwarded the request to the destination and returned its content, acting as a web proxy. This happened also for https//auth.targetdomain, the subdomain believed to host the vulnerable Java component.

Step 3: wrapping the blocked payload

The assumption was that a direct request to

Text
https://auth.targetdomain/vulnerable_endpoint?param=malicious_RCE_payload

lands on the WAF, whose rule recognises the malicious payload in param and answers HTTP 404. If instead the whole URL is base64-encoded, producing

Text
[redacted]==

and passed to cfru as follows:

Text
https//targetdomain/?cfru=[redacted]==

then, in the researchers' reconstruction:

  1. The request crosses the WAF, which has nothing to complain about, because the payload is hidden inside the base64 value.
  2. The Bluecoat device base64-decodes cfru and issues a GET request to the internal host https://auth.targetdomain/vulnerable_endpoint?param=malicious_RCE_payload.
  3. That request triggers the vulnerability.

Step 4: confirming execution

The output of the malicious payload, nothing more than the hostname command, came back exfiltrated via DNS, since outgoing TCP connections to the researchers' host on the internet were blocked.

From the original on redtimmy.com

The screenshot relates to the DNS exfiltration of the command output.

Step 5: returning output in HTTP headers

The researchers then adjusted the payload so that the output of injected commands was returned directly as part of the HTTP headers in the server reply.

From the original on redtimmy.com

The screenshot relates to command output returned in the response headers.

Root cause

The report identifies two mistakes:

  1. The Bluecoat device behaved as a request forwarder instead of responding with an HTTP redirect, as it did for other URLs. A redirect would have caused the subsequent client requests to be caught and blocked by the WAF.
  2. No WAF rule base64-decoded the cfru parameter before it reached the Bluecoat device, so the WAF could not check whether the request content matched its blocking rules.

In other words, no WAF rule decoded the cfru parameter, while the proxy acted on the decoded value. The WAF rule blocking the payload was bypassed by an encoding step performed downstream.

Impact

Under these conditions an attacker could reach an internal endpoint that the WAF was specifically configured to block, and execute commands on the vulnerable Java component. In the researchers' tests, outbound TCP was blocked, so command output was retrieved over DNS or embedded in HTTP response headers. The affected company was a Fortune 500, and the researchers notified the vendor straight away; the vendor recognised a bug bounty. The report does not give the bounty amount, a CVSS score or the number of affected systems.

Fix

The report does not describe the remediation the vendor applied. The two changes it points to are the ones implied by the root cause: make the Bluecoat device respond with an HTTP redirect rather than forwarding the request and returning the content, and add a WAF rule that base64-decodes the cfru parameter before passing it on, so the decoded content is analysed against the blocking rules. The broader lesson stated is that virtual patching is acceptable to buy time before fixing a serious vulnerability, but using it in place of real patching means it is only a question of time before a compromise.

Variants to test

  1. Look for proxy or filter parameters carrying encoded URLs (cfru and similar) on redirects during authentication or SSO flows. A positive result is a parameter that accepts an arbitrary URL without authentication.
  2. Encode an external URL under your control and watch for DNS resolution from the target. DNS-only callbacks indicate outbound TCP is filtered but the proxy still resolves and fetches.
  3. Encode internal hostnames and compare responses: a 302 for some URLs and full HTML content for others suggests the proxy is forwarding and returning content for the latter.
  4. Take a request the WAF blocks (HTTP 404 on a known malicious parameter) and wrap the entire URL in the encoding the proxy expects. A positive result is the same endpoint returning content or executing instead of 404.
  5. Try alternative encodings the WAF may not decode (double base64, URL-encoded base64, mixed case) against the same parameter.
  6. Where command execution is achieved but outbound TCP is blocked, test DNS exfiltration and reflection of output into HTTP response headers.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

What happened, in plain words

A security company found a way to bypass a Fortune 500 company's WAF and run commands on a vulnerable server. The company had put up a security device (a Web Application Firewall, or WAF) to block attacks, but the attackers got around it by using a second security device (a Bluecoat proxy) that was misconfigured. The researchers reported the problem and were paid a bug bounty. This article explains, step by step, how they did it, in language anyone can follow.

Background: the pieces of the puzzle

Before we dive into the attack, let's understand the key terms and components.

  • Target: The company's website, referred to as targetdomain. It had several applications under https://targetdomain/appname, and a separate login system at https://auth.targetdomain.
  • Java component: A piece of software written in Java that runs on the server. This particular component was known to have a serious flaw that allows an attacker to run their own commands on the server. This is called Remote Code Execution (RCE). Think of it as a robot with a known weakness that lets someone else control it.
  • WAF (Web Application Firewall): A security device that sits in front of web servers and inspects incoming requests. It looks for patterns that match known attacks and blocks them. Imagine a security guard at a door who checks everyone's bag for weapons.
  • Bluecoat proxy: A device that filters and forwards web traffic. It can also cache content and act as an intermediary. In this case, it had a feature that took a parameter called cfru, which contained a base64-encoded URL. Base64 is just a way to represent data (like a URL) as a string of letters and numbers. For some URLs the proxy decoded it, fetched the URL and returned its content.
  • Base64 encoding: A method to convert data into a text format using 64 characters. It's often used to safely transmit data over the internet. For example, the URL https://targetdomain/appname becomes [redacted]==.
  • SSRF (Server-Side Request Forgery): A vulnerability where an attacker can make a server send requests to other systems, often internal ones that are not directly accessible from the internet. Imagine tricking a company's mailroom into sending a package to any address you choose.
  • DNS (Domain Name System): The internet's phonebook. It translates human-readable domain names (like example.com) into IP addresses. DNS traffic is often allowed even when other outbound connections are blocked.
  • HTTP redirect (302): A response from a server telling the browser to go to a different URL. Like a signpost saying "the page you want is over there."
  • HTTP headers: Extra information sent along with a web request or response, such as the type of content or cookies. They are not the main body (like HTML) but metadata.

The observation: spotting the vulnerable component

The researchers were browsing the target's website, almost by accident, when they noticed something interesting. The login subdomain (auth.targetdomain) was serving CSS and JavaScript files that belonged to a Java component known to be vulnerable to RCE. CSS and JavaScript are files that style and add interactivity to web pages; their presence suggested that this component was in use.

They tried to access the vulnerable endpoint directly. The endpoint is a specific URL path that triggers the component's functionality. They sent a request like:

Text
https://auth.targetdomain/vulnerable_endpoint?param=malicious_RCE_payload

Here, param is a parameter that the component uses, and malicious_RCE_payload is a placeholder for the actual attack code. But the server responded with HTTP 404, which means "Not Found". That was odd: if the endpoint didn't exist, why were its CSS and JavaScript files accessible? They suspected a WAF was blocking the request. After a few more attempts, all blocked, they confirmed that a WAF rule was indeed preventing access to that endpoint.

The weird thing: the cfru parameter

While logging into an application at https://targetdomain/appname, they were redirected to https://auth.targetdomain for authentication. During this process, they noticed a redirect to a URL like:

Text
https//targetdomain/?cfru=[redacted]==

(Note: the missing colon after https is likely a typo in the original report; it should be https://.)

The cfru parameter contained a base64-encoded string. Decoding [redacted]== gives https://targetdomain/appname, which is the URL they originally wanted to access before authentication. So cfru seemed to carry the original URL.

A quick search revealed that cfru is part of Bluecoat web filtering technology. This told them that the target's infrastructure included at least one WAF and a Bluecoat proxy in front of the web servers. The diagram below reconstructs the path of an HTTP request:

From the original on redtimmy.com

The diagram reconstructs the request path described above.

The idea: abusing cfru for SSRF

The cfru parameter was publicly accessible: no authentication was needed to use it. The researchers thought: what if we put our own URLs in cfru? The Bluecoat proxy might fetch them, potentially allowing us to make the server send requests to arbitrary destinations (SSRF). They base64-encoded URLs of external domains under their control and fed them into cfru. They hoped to see HTTP requests coming back to their servers, but none arrived. However, they did see DNS lookups originating from targetdomain on their internet-facing machines. This indicated that the target's outbound TCP connections were blocked, but DNS traffic was allowed. So DNS resolution was happening from targetdomain, but outbound TCP connections were blocked.

The turning point: internal subdomains

Since external connections were blocked, they switched to internal subdomains: https://auth.targetdomain, https://blog.targetdomain, https://www.targetdomain, etc. They encoded these URLs in base64 and passed them to cfru. The responses varied: some URLs returned HTTP 302 redirects, while others returned the actual HTML content of the requested resource. This suggested that for some URLs, the Bluecoat proxy was acting as a forward proxy: it fetched the content and returned it directly, rather than redirecting the client. Crucially, this happened for https//auth.targetdomain (again, likely a typo for https://auth.targetdomain), the subdomain hosting the vulnerable Java component.

The exploitation: wrapping the blocked payload

The researchers hypothesized: if they directly request the vulnerable endpoint with a malicious payload, the WAF blocks it with a 404. But if they encode the entire URL in base64 and pass it to cfru, the WAF might not inspect the decoded content, and the Bluecoat proxy would decode it and make the request internally, bypassing the WAF.

They took the URL:

Text
https://auth.targetdomain/vulnerable_endpoint?param=malicious_RCE_payload

and base64-encoded it to:

Text
[redacted]==

Then they constructed the following request:

Text
https//targetdomain/?cfru=[redacted]==

(Again, the missing colon after https is likely a typo.)

What happened next, in their reconstruction:

  1. The request passed through the WAF. The WAF saw only a base64 string in the cfru parameter, which didn't match any attack patterns, so it allowed the request.
  2. The request reached the Bluecoat proxy. The proxy decoded the cfru parameter, extracted the URL https://auth.targetdomain/vulnerable_endpoint?param=malicious_RCE_payload, and issued a GET request to that internal host.
  3. The internal request triggered the vulnerability in the Java component, executing the malicious payload.

Bingo! Confirming execution

The payload they used was simply the hostname command, which returns the server's hostname. They saw the output of this command exfiltrated via DNS. Outgoing TCP connections to their host on the internet were blocked, so DNS was the only channel.

From the original on redtimmy.com

The screenshot relates to the DNS exfiltration of the command output.

They also experimented with making the output of injected commands appear directly in the HTTP response headers. This way, they could see the command output in the server's reply without needing DNS.

From the original on redtimmy.com

The screenshot relates to command output returned in the response headers.

Conclusion: root cause and lessons

The report identifies two mistakes that allowed the bypass:

  1. The Bluecoat device forwarded requests and returned content instead of responding with an HTTP redirect. If it had redirected, the client would have followed the redirect, and the subsequent request would have been caught and blocked by the WAF.
  2. The WAF did not base64-decode the cfru parameter before passing it to the Bluecoat device. So the WAF could not inspect the actual URL being requested and check it against its blocking rules.

In other words, no WAF rule decoded the cfru parameter, but the proxy acted on the decoded value. The WAF rule blocking the payload was bypassed by an encoding step performed downstream.

Impact

Under these conditions, an attacker could reach an internal endpoint that the WAF was specifically configured to block, and execute commands on the vulnerable Java component. In the researchers' tests, outbound TCP was blocked, so command output was retrieved over DNS or embedded in HTTP response headers. The affected company was a Fortune 500, and the researchers notified the vendor straight away; the vendor recognised a bug bounty. The report does not give the bounty amount, a CVSS score or the number of affected systems.

Fix

The report does not describe the remediation the vendor applied. The two changes it points to are the ones implied by the root cause: make the Bluecoat device respond with an HTTP redirect rather than forwarding the request and returning the content, and add a WAF rule that base64-decodes the cfru parameter before passing it on, so the decoded content is analysed against the blocking rules. The broader lesson stated is that virtual patching is acceptable to buy time before fixing a serious vulnerability, but using it in place of real patching means it is only a question of time before a compromise.

Variants to test

  1. Look for proxy or filter parameters carrying encoded URLs (cfru and similar) on redirects during authentication or SSO flows. A positive result is a parameter that accepts an arbitrary URL without authentication.
  2. Encode an external URL under your control and watch for DNS resolution from the target. DNS-only callbacks indicate outbound TCP is filtered but the proxy still resolves and fetches.
  3. Encode internal hostnames and compare responses: a 302 for some URLs and full HTML content for others suggests the proxy is forwarding and returning content for the latter.
  4. Take a request the WAF blocks (HTTP 404 on a known malicious parameter) and wrap the entire URL in the encoding the proxy expects. A positive result is the same endpoint returning content or executing instead of 404.
  5. Try alternative encodings the WAF may not decode (double base64, URL-encoded base64, mixed case) against the same parameter.
  6. Where command execution is achieved but outbound TCP is blocked, test DNS exfiltration and reflection of output into HTTP response headers.

Glossary

  • API: Application Programming Interface; a set of rules that allows different software to communicate. (Not directly used in this article, but often relevant.)
  • Base64: A binary-to-text encoding scheme that represents data in an ASCII string format. Used to safely transmit data over text-based protocols.
  • Bluecoat proxy: A web filtering and caching proxy appliance. In this context, it had a feature that decoded and fetched URLs from the cfru parameter.
  • Bug bounty: A program where organisations reward security researchers for finding and reporting vulnerabilities.
  • cfru: A parameter used by Bluecoat proxies that contains a base64-encoded URL, typically the originally requested resource.
  • CSS: Cascading Style Sheets; files that define the look and formatting of a web page.
  • CVSS: Common Vulnerability Scoring System; a standard for rating the severity of security vulnerabilities.
  • DNS: Domain Name System; the internet's phonebook, translating domain names to IP addresses.
  • DNS exfiltration: A technique to extract data from a compromised system by encoding it in DNS queries.
  • Endpoint: A specific URL or URI that an application responds to.
  • Fortune 500: A list of the 500 largest companies in the United States by revenue.
  • HTTP 302: An HTTP status code indicating a temporary redirect.
  • HTTP 404: An HTTP status code indicating that the requested resource was not found.
  • HTTP headers: Additional information sent with an HTTP request or response, such as content type or cookies.
  • Java: A programming language and computing platform. A Java component is a piece of software written in Java.
  • JavaScript: A programming language used to create interactive effects within web browsers.
  • RCE (Remote Code Execution): A vulnerability that allows an attacker to execute arbitrary commands on a remote server.
  • SSRF (Server-Side Request Forgery): A vulnerability where an attacker can make a server send requests to other systems, often internal ones.
  • TCP: Transmission Control Protocol; a core protocol of the internet that enables reliable data transmission.
  • Virtual patching: A security measure that blocks attacks at the network or application layer without fixing the underlying vulnerability.
  • WAF (Web Application Firewall): A security device that monitors and filters HTTP traffic to protect web applications from attacks.

More by redtimmysec

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.