Infrastructure security testing — a CDN, WAF, and proxy don't mean secure until tested — Defensys Innovations

Introduction

Modern web applications are protected by several layers of security infrastructure. CDNs help deliver content faster, WAFs block malicious requests, reverse proxies hide backend servers, and load balancers distribute traffic between servers.

These technologies are useful, but having them in place does not automatically make an application secure.

Security tools do not replace security testing.

A security control can be misconfigured, outdated, or bypassed. For example, an organization may use a CDN to hide its origin server, but an old DNS record could still reveal the real IP address. A WAF may block common SQL injection payloads but still allow a different request format that reaches the application.

Many organizations deploy these technologies and then assume they will work correctly without regularly testing them. This can leave weaknesses that attackers can discover and abuse.

In this blog, we will look at the security risks that can exist around CDNs, WAFs, reverse proxies, and load balancers, and why testing these layers is an important part of web application security.

Understanding Your Infrastructure Layers

Before looking at the possible security issues, it is important to understand what these technologies actually do and what their limitations are.

Content Delivery Networks (CDNs): Faster Content Delivery

What it does:

A CDN, such as Cloudflare, Akamai, or AWS CloudFront, stores copies of content on servers in different locations around the world. This allows users to receive content from a server that is closer to them.

Example:

Suppose your application is hosted on a server in New York and a user accesses it from Tokyo. Instead of every request traveling to New York, the CDN can serve cached content from a nearby location. This reduces latency and makes the website faster.

What it doesn’t do:

A CDN is not a replacement for application security. Depending on the configuration, it may not protect against vulnerabilities in the application itself, and it does not guarantee that the origin server cannot be discovered.

For example, an old DNS record, exposed subdomain, email configuration, or historical DNS data may reveal the origin IP address. If an attacker finds the real IP, they may try connecting directly to the origin server instead of going through the CDN.

This is one area where penetration testing can help identify whether the origin is actually protected.

Web Application Firewalls (WAFs): Filtering Malicious Requests

What it does:

A WAF monitors HTTP and HTTPS traffic and looks for patterns commonly associated with attacks such as SQL injection, XSS, and command injection.

Example:

An attacker sends a request containing a common SQL injection payload such as:

' OR '1'='1

If the WAF recognizes the request as malicious, it can block it before it reaches the application.

What it doesn’t do:

A WAF cannot protect against every type of vulnerability. It may not detect business logic flaws, authentication problems, access control issues, or new attack techniques that do not match its existing rules.

Attackers can also try different encodings, request formats, or payloads to determine how the WAF processes traffic.

This is why testing should not stop at checking whether the WAF blocks a basic payload. Security testing should also verify whether the application remains secure when requests are modified or handled differently.

Reverse Proxies: The Middle Layer

What it does:

A reverse proxy such as Nginx or Apache sits between the user and the backend application server.

For example, a user may connect to:

app.example.com

The reverse proxy then forwards the request to a backend server that the user cannot directly access. Reverse proxies can also handle tasks such as TLS termination, caching, compression, and request routing.

What it doesn’t do:

A reverse proxy does not automatically hide every detail about the backend infrastructure.

Incorrect configurations can expose information through HTTP headers, error messages, debug pages, or other responses. These may reveal server versions, internal hostnames, IP addresses, or other useful information.

During a security assessment, these responses should be reviewed to determine what information is exposed to an unauthenticated user.

Load Balancers: Distributing Traffic

What it does:

A load balancer distributes incoming requests across multiple backend servers.

For example, if a website receives 10,000 requests at the same time, a load balancer could distribute those requests across 10 servers instead of sending everything to a single server. This improves availability and prevents one server from handling all the traffic.

What it doesn’t do:

A load balancer is primarily designed for traffic distribution and availability, not as a complete security control.

Configuration differences between backend servers can create security gaps. For example, one server might have a security rule enabled while another backend server has a different configuration.

If an attacker can reach a less protected backend directly, they may be able to bypass security controls applied to the normal traffic path.

Why Security Testing Behind These Layers Is Important

It is common to hear statements such as:

“We use a WAF, our CDN hides the server, and our reverse proxy handles the traffic, so we are protected.”

These controls can reduce risk, but they should not be treated as a guarantee of security.

Consider a hypothetical fintech application using a CDN, WAF, reverse proxy, and load balancer. During a security assessment, a tester might discover:

  1. An old DNS record reveals the origin server IP.
  2. The WAF blocks common attack payloads but handles certain request formats differently.
  3. The reverse proxy exposes backend software information through response headers.
  4. One backend server can be reached directly without passing through the expected security controls.

Individually, these issues may not immediately lead to a compromise. However, together they can create a path for an attacker to bypass parts of the security architecture.

This is why testing should cover not only the application itself, but also the infrastructure sitting in front of and behind it.

Common Vulnerabilities Behind Infrastructure Layers

Once you understand how these infrastructure layers work, the next step is to look at the security problems that can occur when they are misconfigured or incorrectly trusted.

1. Origin Server Exposure

What it is:

An origin server is the actual server hosting the application behind a CDN or reverse proxy. If an attacker discovers its IP address, they may be able to connect to it directly and bypass security controls such as the CDN or WAF.

How it can happen:

  • Old DNS records still reveal the original IP address
  • Email headers expose server information
  • Certificate Transparency logs reveal related hostnames
  • DNS records contain unused or forgotten subdomains
  • Server response headers reveal infrastructure details
  • Cloud resources are accidentally exposed to the internet

Example:

Suppose the application normally works like this:

User → CDN → WAF → Origin Server

If the attacker discovers the origin IP, they may try:

Attacker → Origin Server

If the origin accepts direct connections without applying the same security controls, the attacker may be able to bypass the CDN and WAF.

Security testing:

During an assessment, testers can look for historical DNS records, certificate information, subdomains, cloud assets, response headers, and other sources that could reveal the origin.

2. WAF Bypass Techniques

What it is:

A WAF looks for suspicious requests and blocks traffic that matches its rules. However, the WAF and the backend application may interpret a request differently. This difference can sometimes be used to bypass the WAF.

Common techniques include:

HTTP Parameter Pollution

An attacker may send the same parameter multiple times:

GET /search?q=malicious&q=normal HTTP/1.1

Different servers and frameworks may handle duplicate parameters differently. For example, the WAF might inspect the first value while the application uses the second value, or the other way around. The important point is that the WAF and application should interpret the request consistently.

Encoding Variations

Attackers can modify the representation of a payload using techniques such as URL encoding or double encoding.

For example:

<script>alert(1)</script>

can be represented in an encoded form. If the WAF decodes the request differently from the application, this difference may create an opportunity for bypass.

Header Manipulation

Some WAF configurations may inspect certain parts of a request more carefully than others. Testing should therefore include parameters, cookies, HTTP headers, and different request methods where relevant.

Application Logic

WAFs are mainly designed to detect suspicious traffic patterns. They generally cannot understand every business rule in an application. For example, a WAF may not detect an authorization flaw where a user can access another user’s account simply by changing an ID — exactly the kind of Insecure Direct Object Reference (IDOR) that only manual testing reliably catches.

Security testing:

A tester should not only check whether a basic payload is blocked. They should also compare how the WAF and application process different encodings, parameters, headers, and request formats. This inconsistent-parsing problem is closely related to HTTP request smuggling, where a front-end and back-end disagree on how to interpret the same request.

3. Reverse Proxy Information Disclosure

What it is:

A reverse proxy can accidentally expose information about the backend infrastructure through HTTP responses.

Common examples include:

Server: nginx/1.19.3

or:

X-Powered-By: PHP/8.1

Error responses can sometimes expose even more information, such as internal hostnames, IP addresses, database names, or application stack traces.

For example:

Database connection failed
Host: db-server.internal

This information may help an attacker understand the internal architecture.

Security testing:

Review response headers, error pages, redirects, debugging information, and unexpected HTTP responses. The goal is to determine whether unnecessary infrastructure details are exposed to unauthenticated users.

4. Load Balancer Misconfiguration

What it is:

A load balancer distributes traffic between multiple backend servers. Problems can occur when those servers do not have consistent security configurations.

Common issues include:

  • Different security settings on backend servers
  • Backend servers that can be accessed directly
  • Health check endpoints exposing unnecessary information
  • Weak or inconsistent TLS configuration
  • Incorrect session handling
  • Sensitive management interfaces exposed through the load balancer

For example, a health endpoint such as:

/health

might be intended to return:

{"status":"ok"}

but instead expose information such as database connections, internal hostnames, application versions, or system metrics.

Security testing:

Test whether backend servers behave consistently and whether health check or management endpoints expose information that should not be publicly accessible.

5. CDN Cache Poisoning

What it is:

CDNs store cached responses so that future users can receive them without contacting the origin server every time.

Cache poisoning occurs when an attacker manages to make the CDN store an attacker-controlled response and then serves that response to other users.

Common areas to test include:

  • Differences between the CDN cache key and the application’s request handling
  • Host header handling
  • Query parameter normalization
  • URL normalization
  • Differences between cached and non-cached responses
  • Unexpected headers being included in cache decisions

For example, if the CDN ignores a parameter when creating its cache key but the application uses that parameter when generating the response, an attacker may be able to create a response that gets cached and later delivered to other users.

Security testing:

Test how the CDN creates cache keys and whether changing headers, parameters, or URL formats changes the response while the CDN still treats the requests as the same cached resource.

6. SSL/TLS Misconfiguration

What it is:

HTTPS protects traffic between a client and a server, but modern applications often have several connections between different infrastructure layers.

For example:

User → CDN → Load Balancer → Backend Server

Each connection needs to be configured correctly.

Common issues include:

  • HTTP used between infrastructure layers
  • Expired or incorrectly configured certificates
  • Weak TLS versions or cipher suites
  • Certificates not properly validated between internal services
  • Sensitive traffic being transmitted without encryption

For example, the connection between the user and CDN may use HTTPS, while the CDN connects to the origin using plain HTTP. In that situation, the traffic is protected on the first connection but not necessarily on the second one.

Security testing:

Review TLS configuration at each layer rather than checking only the public website. The CDN, load balancer, reverse proxy, and backend connections should all be considered when assessing encryption.

The Main Lesson

The important thing to understand is that adding more infrastructure layers does not automatically eliminate security vulnerabilities.

Each layer introduces its own configuration, request handling, and trust relationships. A weakness in one layer can sometimes allow an attacker to bypass another layer.

This is why infrastructure should be tested as part of the overall security assessment, rather than assuming that the CDN, WAF, reverse proxy, or load balancer will handle everything automatically.

Real-World Security Incident: Cloudflare Cloudbleed

The Incident

In February 2017, Cloudflare disclosed a serious security bug that became known as Cloudbleed.

The vulnerability was caused by a memory handling problem in a parser used by Cloudflare’s infrastructure. Under certain conditions, the parser could read beyond the end of a buffer and return data from nearby memory.

That memory could contain information belonging to other users, including HTTP cookies, authentication tokens, and POST data. Some of the leaked information was also picked up by search engine caches.

The incident is a good example of why security should not be based only on trusting an infrastructure provider or security product. Even large security platforms can contain vulnerabilities, which is why organizations need monitoring, testing, and additional controls around their own infrastructure.

What Happened

Cloudflare’s investigation found that the vulnerable parser had been running since September 2016, although the conditions required to trigger the problem were relatively unusual.

On February 18, 2017, Google’s Project Zero researcher Tavis Ormandy reported the problem to Cloudflare. Cloudflare investigated the issue, stopped the leak, and published a detailed incident report.

Cloudflare later reported that it found no evidence in the logs it reviewed that the vulnerability had been maliciously exploited before it was fixed. However, leaked information had been cached by search engines, which created an additional risk.

What We Can Learn From It

Cloudbleed was not an origin server exposure vulnerability. However, it demonstrates an important principle for infrastructure security:

Security infrastructure itself needs to be tested and monitored.

A CDN or WAF can provide an important layer of protection, but it can still contain bugs, configuration problems, or unexpected behavior.

There is also a separate and well-known risk involving origin server exposure. Cloudflare’s current documentation explains that if an origin IP is exposed, an attacker may be able to connect directly to the origin instead of going through Cloudflare. Cloudflare recommends controlling access to the origin and, where appropriate, using mechanisms such as Authenticated Origin Pulls so that the origin can verify that requests are actually coming through Cloudflare.

This gives us two different lessons:

  1. Security infrastructure can contain vulnerabilities of its own.
  2. Your own origin infrastructure still needs to be protected if its IP address is discovered.

What Professional Security Testing Should Include

A professional infrastructure security assessment should look beyond the main application and test how the different layers work together.

1. Origin Server Discovery

Determine whether the real origin IP addresses can be discovered through DNS records, historical data, certificates, subdomains, cloud infrastructure, or other publicly available information.

If an origin is exposed, verify whether it can be accessed directly and whether the same security controls are applied.

2. WAF Bypass Testing

Test whether the WAF consistently handles different request formats, encodings, parameters, headers, and HTTP methods.

The goal is not simply to find a payload that bypasses the WAF, but to understand whether the WAF and application interpret requests differently.

3. Infrastructure Information Disclosure

Review HTTP headers, error responses, certificates, DNS records, debug responses, and other metadata.

Look for unnecessary information about:

  • Server software
  • Software versions
  • Internal hostnames
  • Internal IP addresses
  • Backend technologies
  • Frameworks and dependencies

4. Load Balancer and Backend Testing

Check whether backend servers have consistent security configurations.

Also verify that health checks, management interfaces, administrative endpoints, and backend services are not unnecessarily exposed.

5. CDN and Cache Security

Test how caching behaves when URLs, parameters, headers, and hostnames are modified.

The goal is to determine whether an attacker can cause an unexpected response to be cached and later served to other users.

6. SSL/TLS Validation

Review encryption at every important connection:

User → CDN → Load Balancer → Reverse Proxy → Backend

Do not assume that checking the public HTTPS connection is enough. Internal connections between infrastructure layers should also be reviewed.

7. Trust Relationship Testing

Check whether one infrastructure component blindly trusts information supplied by another.

Examples include:

  • Host
  • X-Forwarded-For
  • X-Forwarded-Host
  • Client IP headers
  • Authentication headers
  • Proxy-specific headers

The goal is to determine whether an attacker can manipulate trusted information and change how the application or infrastructure handles the request.

8. Application-Level Testing

Infrastructure security does not replace application security testing.

Authentication flaws, authorization problems, IDOR, business logic vulnerabilities, SSRF, SQL injection, XSS, and other application vulnerabilities can still exist even when a strong WAF and CDN are deployed.

Conclusion

CDNs, WAFs, reverse proxies, and load balancers are important parts of modern web infrastructure. They can improve performance, availability, and security, but they should not be treated as a complete security solution.

A security layer is only useful if it is configured correctly and behaves as expected.

An exposed origin server can allow attackers to bypass the CDN. A WAF may handle a request differently from the application. A reverse proxy may expose internal information. A load balancer may route traffic to a backend with weaker security controls. Even the security infrastructure itself can contain vulnerabilities, as demonstrated by the Cloudbleed incident.

This is why infrastructure security should be tested, monitored, and regularly reviewed.

The goal of a professional security assessment is not simply to check whether a WAF or CDN exists. It is to answer practical questions:

  • Can the origin server be discovered?
  • Can the security layers be bypassed?
  • Do different infrastructure components interpret requests consistently?
  • Are backend systems protected as well as the public-facing layer?
  • Is sensitive infrastructure information being exposed?
  • Is encryption correctly configured between each layer?
  • Can application-level vulnerabilities still be exploited despite the infrastructure controls?

The key takeaway is simple:

Security tools add layers of protection, but security testing tells you whether those layers actually work.

References & Further Reading

  • Cloudflare — Incident report on memory leak caused by Cloudflare parser bug (Cloudbleed)
  • Google Project Zero — Cloudflare: Cloudflare Reverse Proxies are Dumping Uninitialized Memory (Issue 1139)
  • Cloudflare Docs — Protecting your origin server & Authenticated Origin Pulls
  • PortSwigger Research — Practical Web Cache Poisoning (James Kettle)
  • OWASP — Web Application Firewall & Testing for Host Header Injection

Also Read

Continue exploring our security research:

← Back to Blog