When IP Blocklists Fail: How Attackers Hide Cloud Metadata Addresses Behind Hostnames

Listen to this Post

Featured ImageIntroduction: The Dangerous Weakness Behind a Simple IP Address

A single IP address can look like an easy security problem. Add it to a blocklist, reject requests containing it, and move on. Unfortunately, modern attackers have learned that the internet rarely works that simply.

The address 169.254.169.254 is a particularly important example. It is widely associated with cloud instance metadata services, which can expose valuable information from cloud workloads when applications are vulnerable to Server-Side Request Forgery (SSRF). Security teams have therefore spent years blocking direct requests to this address.

But what happens when the application never sees the IP address at all?

Instead of requesting http://169.254.169.254, an attacker can sometimes supply a hostname that resolves to the same destination. From the application’s perspective, the request contains a completely different string. From the network’s perspective, however, the DNS lookup can ultimately point straight back to the sensitive address.

That simple difference between what an application sees and where a connection actually goes is at the heart of this security problem.

The original security diary highlighted observations from researchers who encountered attackers using specially constructed hostnames to disguise sensitive IP addresses. Examples included domains based on services such as nip.io, sslip.io, and dynamic DNS/rebinding infrastructure.

The lesson is uncomfortable but important: blocking a string is not the same thing as controlling a destination.

The Original Problem: Blocking 169.254.169.254

Why This Address Matters

The address 169.254.169.254 belongs to the IPv4 link-local address space, but in major cloud environments it has historically been used to expose instance metadata services.

Depending on the cloud platform and configuration, metadata services may provide information about the running instance, credentials, tokens, configuration details, identity information, or other sensitive data.

That makes the address an attractive target when an attacker discovers an SSRF vulnerability.

The SSRF Connection

Server-Side Request Forgery occurs when an application can be manipulated into making network requests chosen or influenced by an attacker.

Imagine a web application that accepts a URL:

https://example.com/fetch?url=https://trusted-site.example

If the application retrieves the supplied URL on behalf of the user without sufficiently restricting destinations, an attacker may attempt to make the server request an internal resource instead.

The dangerous request could conceptually look like:

http://169.254.169.254/

The security team may then respond by blocking that literal IP address.

Unfortunately, that defense can be defeated if the application resolves hostnames after performing its simplistic filtering.

The Weakness of String-Based Security

A Blocklist Sees Text, Not Intent

Consider a filter that rejects requests containing:

169.254.169.254

At first glance, it seems reasonable.

But DNS gives attackers another layer between the hostname submitted to an application and the destination ultimately contacted by the server.

A hostname can potentially resolve to an IP address without containing that address in the obvious dotted-decimal format.

For example, security researchers have observed hostname patterns such as:

169.254.169.254.nip.io

and:

169-254-169-254.sslip.io

These services are designed to map specially formatted hostnames to IP addresses.

The important point is not the particular service. The important point is the architectural weakness: a hostname can represent a network destination without looking like that destination to a naive text filter.

DNS Changes the Security Equation

The Application May Not Know the Final Destination Yet

When an application receives a URL, several things can happen before a connection is established.

The application parses the URL.

It validates the hostname.

The operating system or resolver performs DNS resolution.

A destination IP is returned.

The HTTP client establishes a connection.

The request is sent.

If security controls only inspect the original hostname, they may never evaluate the final destination.

That creates a dangerous gap between URL validation and network enforcement.

The Hostname Trick Is More Than Obfuscation

Encoding Is Only One Part of the Problem

Attackers do not necessarily need sophisticated encoding.

A hostname can simply act as an intermediary representation of an IP address.

The original diary also described hostnames involving dynamic DNS and DNS-rebinding-style behavior. One example referenced a hostname associated with 1u.ms, a service capable of dynamically controlling DNS responses.

This matters because a hostname does not necessarily have to resolve to the same address forever.

A security-sensitive application could resolve a hostname at one point, perform validation, and later connect using a different resolution result if its networking architecture allows that behavior.

That is why DNS rebinding is particularly relevant to SSRF defenses.

Why DNS Rebinding Makes SSRF Harder

The Destination Can Potentially Change

A simplified DNS-rebinding scenario looks like this:

Application

|

| DNS lookup

v

Hostname
|
v

Public IP

The application may decide that the destination appears safe.

But if the hostname subsequently resolves differently:

Application

|

| Later DNS lookup

v

Same hostname

|
v

Internal/private destination

the final connection may no longer match the destination that was originally validated.

This is why robust SSRF defenses must consider DNS resolution behavior, redirects, connection reuse, IP validation, and network-level restrictions, rather than relying solely on hostname strings.

Why nip.io and sslip.io Are Relevant

Convenient DNS Services Can Have Security Implications

Services such as nip.io and sslip.io provide legitimate functionality by allowing IP addresses to be represented through hostnames.

For developers, this can be convenient during testing and development.

For defenders, however, such services demonstrate why hostname filtering cannot automatically be treated as equivalent to IP filtering.

A hostname may encode or represent an IP address while bypassing simplistic filters that only look for conventional IP notation.

The technology itself is not inherently malicious.

The security problem arises when an application assumes that the text submitted by the user is an accurate representation of the eventual network destination.

Dynamic Hostnames Add Another Layer

Attack Infrastructure Does Not Always Need Static DNS

The diary also mentioned 1u.ms as an example of infrastructure capable of generating hostnames dynamically.

The important defensive takeaway is not that one particular service should be blocked.

Trying to maintain a permanent list of every DNS service that could potentially be abused is unlikely to scale.

Attackers can register domains.

They can use legitimate infrastructure.

They can exploit cloud services.

They can abuse DNS providers.

They can create new domains.

They can change DNS records.

A security architecture that depends on recognizing every possible hostname-generation service will eventually fall behind.

DNS Logs Can Become a Valuable Detection Source

Watch the Resolution Results

One of the strongest defensive recommendations from the original discussion is also one of the simplest: retain DNS logs.

If an internal workload suddenly resolves a suspicious hostname to a cloud metadata address, that can be an extremely valuable signal.

Security teams should look beyond the queried hostname and examine the answer returned by DNS.

For example, defenders can conceptually search DNS telemetry for:

169.254.169.254

The goal is not necessarily to block every DNS query containing a suspicious string.

Instead, the goal is to identify when a workload attempts to resolve a hostname that ultimately points toward a sensitive destination.

A Better SSRF Defense Model

Validate the Destination After Resolution

A more robust architecture treats hostname resolution as part of the security boundary.

Conceptually:

User Input

|
v

Parse URL

|
v

Validate scheme

|
v

Resolve hostname

|
v

Validate ALL resolved IPs

|
v

Reject private/link-local/loopback/reserved destinations

|
v

Connect

This approach is considerably stronger than:

User Input

|
v

Search for blocked string

|
v

Allow

The second model is fundamentally dependent on the attacker using a particular textual representation.

Deep Analysis

Build Security Around Destination Identity

The most important principle is simple: security controls should evaluate where the server is actually connecting, not merely what the user typed.

For SSRF protection, applications should carefully restrict outbound protocols and destinations.

A URL fetcher may only need HTTPS.

If it does not require arbitrary ports, do not permit arbitrary ports.

If it only needs access to a defined set of external services, use an allowlist.

If internal resources are unnecessary, outbound access to private and link-local ranges should be restricted at the network layer.

Inspect Resolved Addresses

A defensive application should resolve the hostname and inspect every resulting address.

Conceptual Python validation might look like this:

import ipaddress
def is_private_or_reserved(address):
ip = ipaddress.ip_address(address)
return (
ip.is_private
or ip.is_loopback
or ip.is_link_local
or ip.is_reserved
or ip.is_multicast
or ip.is_unspecified
)

The purpose of logic like this is defensive validation: identify destinations that should not normally be reachable by an internet-facing URL fetcher.

Production implementations must account for the

Do Not Stop at One DNS Answer

A hostname can have multiple addresses.

Therefore, checking only the first DNS result can be insufficient.

A defensive implementation should consider the complete set of resolved addresses before establishing the connection.

Conceptually:

addresses = resolve_hostname(hostname)
for address in addresses:
if is_private_or_reserved(address):
raise SecurityError("Destination is not permitted")

The exact implementation depends on the programming language, DNS resolver, HTTP library, and deployment architecture.

Revalidate at Connection Time

There is another important problem: the time between DNS resolution and connection.

Security researchers often describe this class of issue as a time-of-check/time-of-use problem.

In simplified form:

CHECK:

hostname -> safe IP

TIME PASSES

USE:

hostname -> different IP

A secure design should minimize this gap and ensure that the address being connected to is the address that was actually approved.

For high-risk systems, application-level checks should be reinforced with network-level egress controls rather than treated as the only defense.

Disable Unnecessary Redirects

Redirects can also turn a seemingly safe request into an unexpected destination.

For example:

User URL

|
v

Safe public domain

|

| HTTP redirect

v

Internal destination

If an HTTP client automatically follows redirects, the original validation may no longer protect the subsequent request.

Applications should either disable redirects or validate every redirect destination independently.

Restrict the URL Scheme

A URL fetcher should not automatically accept every possible protocol.

If the application only needs HTTPS, allowing other schemes increases attack surface.

A basic conceptual check is:

from urllib.parse import urlparse
parsed = urlparse(user_url)
if parsed.scheme not in {"https"}:
raise SecurityError("Unsupported URL scheme")

Again, the correct policy depends on the

Validate Ports

Hostname validation alone is not enough.

An attacker may attempt to direct a server toward an unexpected service running on a sensitive internal port.

Applications should therefore establish explicit rules for permitted ports.

For example:

Allowed:

443

Potentially restricted:

22

25

53

80

8080

8000

9200

2375

The exact list should be determined by the application’s requirements rather than copied blindly.

Use Network-Level Egress Controls

Application validation is important, but it should not be the only defense.

A stronger architecture places restrictions outside the application itself.

For example:

Internet

|
v

Application

|
v

Egress Firewall / Proxy

|

+- Allowed destinations

|

+- Blocked internal ranges

|

+- Blocked metadata endpoints

This provides defense in depth.

If an attacker finds a way around an application’s hostname validation, the network layer can still prevent the connection.

Monitor Metadata Access

Cloud environments should also monitor unexpected access to metadata services.

A workload that normally communicates with external APIs but suddenly attempts to reach a metadata endpoint deserves investigation.

Security telemetry should correlate:

DNS query

+

Resolved IP

+

Source workload

+

HTTP request

+

Network connection

This combination can reveal attacks that would remain invisible if defenders examined only application logs.

The Real Problem With Blocklists

Blocklists Are Useful but Limited

It would be unfair to say that blocklists are completely useless.

They can provide valuable emergency protection.

They can stop known malicious domains.

They can reduce exposure while a permanent fix is being developed.

They can help identify suspicious behavior.

The problem occurs when a blocklist becomes the primary security boundary.

An attacker only needs one representation that is not on the list.

That is an inherent weakness of deny-by-string approaches.

Allowlisting Can Be Stronger

Define What the Application Actually Needs

If an application is supposed to download images from a handful of trusted services, it should not necessarily be allowed to connect to every address on the internet.

An allowlist might conceptually look like:

Approved domains:

cdn.example.com

images.example.net

api.example.org

Everything else is rejected.

This significantly reduces the attack surface.

However, allowlists also require careful implementation because an approved hostname could itself become a path toward an unexpected IP address if DNS behavior is not validated.

Cloud Metadata Requires Special Protection

Metadata Services Should Not Be Treated Like Ordinary Internet Hosts

Cloud providers have introduced stronger protections around metadata services over time, including mechanisms designed to make unauthorized metadata access more difficult.

Organizations should use the strongest metadata-service protections supported by their cloud platform.

They should also avoid assuming that metadata endpoints are safe simply because they are reachable only from inside a cloud network.

An SSRF vulnerability effectively turns an application into a network proxy for an attacker.

That changes the threat model completely.

What Security Teams Should Search For

DNS Telemetry

Defenders should look for DNS queries whose answers correspond to sensitive internal destinations.

For example, a defensive log query could conceptually search for:

169.254.169.254

But organizations should expand detection beyond this single address.

Look for:

127.0.0.0/8

10.0.0.0/8

172.16.0.0/12

192.168.0.0/16

169.254.0.0/16

::1/128

fc00::/7

fe80::/10

The exact detection strategy should reflect the

Application Logs

Applications should record security-relevant URL-fetching events.

Useful telemetry can include:

Timestamp

Source application

User/session identifier where appropriate

Requested hostname

Resolved IP

Destination port

HTTP status

Redirect chain

Connection outcome

Care must be taken not to log sensitive tokens, credentials, authorization headers, or private data.

Network Logs

Network telemetry can provide another layer of visibility.

Look for workloads initiating connections to:

169.254.0.0/16

or other unexpected private, loopback, and link-local destinations.

An unexpected connection from a public-facing application server to a link-local address should receive particular attention.

Safe Detection Testing

Test the Defense Without Attacking Production

Organizations can test their SSRF controls using infrastructure they own.

For example, security teams can create a controlled DNS record pointing to a harmless internal test server and verify whether the application’s URL-fetching mechanism correctly identifies and rejects the destination.

A safe testing architecture looks like:

Test Application

|
v

Controlled DNS

|
v

Controlled Test Server

The objective is to verify that:

hostname -> DNS resolution -> IP validation -> connection

is correctly enforced.

There is no need to target a real cloud metadata endpoint during routine testing.

Why DNS Logs Are Often Undervalued

The Missing Piece in Many Investigations

Organizations frequently collect HTTP logs and firewall logs while treating DNS as background infrastructure.

That is a mistake.

DNS often reveals the

A suspicious hostname can reveal:

Target selection

+

DNS manipulation

+

Infrastructure reuse

+

Potential SSRF activity

Even when the eventual HTTP request is blocked, the DNS query may remain visible.

This makes DNS an important source of early-warning telemetry.

The Broader Security Lesson

Never Confuse Representation With Reality

The central lesson extends far beyond 169.254.169.254.

An IP address can be represented in different forms.

A hostname can resolve to an IP.

A hostname can have multiple IPs.

DNS responses can change.

HTTP redirects can change destinations.

IPv4 and IPv6 can introduce different representations.

Proxies can alter network paths.

Therefore, security controls need to reason about the actual destination and the complete request flow, rather than one textual representation of it.

What Undercode Say:

1. The Blocklist Problem

Blocking 169.254.169.254 as a string is an understandable first defense, but it should never be considered a complete SSRF mitigation.

  1. DNS Is Part of the Attack Surface

DNS is not merely a convenience for translating names into addresses.

In security-sensitive applications, DNS resolution becomes part of the trust boundary.

3. Hostnames Can Hide Destinations

A hostname may appear harmless while ultimately resolving to an address that should never be accessible by the application.

4. SSRF Defenses Must Follow the Connection

The critical security question is not “What hostname did the attacker provide?”

It is “What address is the server actually attempting to contact?”

5. Dynamic DNS Makes Static Defenses Fragile

Attackers do not need to rely on one permanent hostname.

Dynamic DNS infrastructure can make destination manipulation considerably more flexible.

6. DNS Rebinding Deserves Special Attention

Applications that resolve a hostname and later connect to it must account for the possibility that the resolution result has changed.

7. Redirects Can Break Good Validation

Even if the initial destination is safe, automatic redirects can lead to another destination that has never been checked.

8. Multiple DNS Answers Matter

Checking only one address returned by DNS can leave gaps when a hostname resolves to several IPv4 or IPv6 addresses.

9. IPv6 Should Not Be Forgotten

A defense designed exclusively around IPv4 private ranges may fail to protect against equivalent IPv6 destinations.

10. Application Security Is Not Enough

Network-level egress controls should reinforce application-level SSRF protections.

11. Metadata Services Are High-Value Targets

Cloud metadata endpoints can expose information that attackers may use to move deeper into an environment.

12. DNS Logs Can Expose the Attempt

Even when the HTTP request is blocked, DNS telemetry can reveal suspicious resolution activity.

13. Security Monitoring Should Correlate Events

DNS, application, firewall, and cloud telemetry become much more powerful when analyzed together.

14. Allowlisting Reduces Exposure

If an application only needs to contact a few external services, permitting arbitrary destinations creates unnecessary risk.

15. URL Fetchers Need Extra Scrutiny

Applications that retrieve user-supplied URLs are natural SSRF targets and deserve stronger controls than ordinary web applications.

16. Security Filters Need Context

A text filter knows what a string looks like.

It does not necessarily understand what the network connection represents.

17. Cloud Environments Increase the Stakes

A vulnerable application may have access to infrastructure that is invisible from the public internet.

18. Internal Networks Are Not Automatically Trusted

Once an attacker controls where a server connects, internal network boundaries can become much less meaningful.

19. The Same Principle Applies Elsewhere

The distinction between representation and destination appears in many areas of cybersecurity, not just SSRF.

20. Attackers Look for Translation Layers

DNS, redirects, proxies, URL parsers, and encoding systems can all create opportunities for security assumptions to diverge.

21. Parsing Should Be Consistent

Different libraries can interpret URLs differently, creating another potential source of security problems.

22. Normalize Before Validating

Security-sensitive applications should parse and normalize input consistently before making authorization decisions.

23. Validate Every Stage

A secure request pipeline should consider the URL, hostname, DNS result, port, protocol, redirects, and final connection.

24. Never Trust User-Controlled URLs by Default

If a user can control the destination, the application should treat that destination as hostile until proven otherwise.

25. Network Controls Provide a Safety Net

A properly configured egress firewall can prevent an application vulnerability from becoming a broader compromise.

26. Detection Should Look for Behavior

Instead of trying to predict every malicious hostname, security teams should detect suspicious destination behavior.

27. Threat Intelligence Has Limits

Blocking known malicious domains is useful, but newly created or legitimate infrastructure can bypass reputation-based controls.

28. DNS Reputation Is Not Enough

A domain with a clean reputation can still resolve to a dangerous address.

29. Cloud Security Requires Layering

Metadata protection, IAM restrictions, application validation, network controls, and monitoring should work together.

30. Least Privilege Matters

Even if an SSRF vulnerability is exploited, the compromised workload should have as little access as possible.

31. Credentials Should Be Short-Lived

Short-lived credentials can reduce the impact if sensitive metadata is ever exposed.

32. Metadata Access Should Be Rare

Unexpected metadata access from an application should be treated as a potentially important security signal.

33. Security Teams Should Test Their Assumptions

A filter that appears effective on paper should be tested against alternate hostname representations, redirects, IPv6, and DNS behavior.

34. Defensive Testing Should Be Controlled

Testing against owned infrastructure provides useful evidence without creating unnecessary operational or security risks.

35. DNS Visibility Is a Strategic Advantage

Organizations that retain high-quality DNS telemetry are better positioned to identify suspicious destination resolution.

  1. One IP Address Is Only One Indicator

Defenders should monitor entire sensitive address ranges and categories rather than relying exclusively on a single well-known address.

37. Blocklists Still Have Value

They are useful as an additional layer, especially during incident response.

38. But Blocklists Should Not Become Architecture

A resilient security design should remain effective even when an attacker finds a new representation.

39. Destination-Based Security Is the Future

The strongest defenses focus on the actual destination and network behavior instead of relying solely on textual patterns.

40. The Core Lesson

If an application can be tricked into making network requests, validate where those requests actually go.

✅ Hostnames Can Represent IP Addresses

This is correct. DNS allows applications to use hostnames that resolve to IP addresses, and specialized DNS services can make certain IP-to-hostname representations particularly convenient.

✅ 169.254.169.254 Is a Critical Cloud Security Address

Correct. The address has historically been used by major cloud platforms for instance metadata services, making unauthorized access to it a significant SSRF concern.

✅ SSRF Can Be Used to Reach Internal Resources

Correct. SSRF vulnerabilities can allow an attacker to influence server-side network requests toward destinations that the attacker cannot directly reach.

✅ DNS Rebinding Is a Real Security Concern

Correct. DNS resolution can change over time, and applications that separate validation from connection without accounting for this behavior can create security weaknesses.

⚠️ Blocklists Are Not Completely Useless

The

⚠️ DNS Services Are Not Automatically Malicious

Services such as nip.io, sslip.io, and dynamic DNS platforms have legitimate uses. Their availability to attackers does not make the services themselves malicious.

Prediction

(+1) SSRF Defense Will Continue Moving Toward Destination Validation

As cloud applications become more complex, security teams will increasingly move away from simple hostname and string filtering toward destination-aware controls.

(+1) DNS Telemetry Will Become More Important

Organizations will likely place greater emphasis on DNS logging and correlation as attackers continue abusing resolution mechanisms and dynamic infrastructure.

(+1) Cloud Metadata Protection Will Improve

Cloud providers are likely to continue strengthening metadata services and introducing additional safeguards designed to reduce the impact of SSRF vulnerabilities.

(+1) Network Egress Controls Will Gain Importance

More organizations will treat outbound traffic as a security boundary instead of assuming that internal workloads should have unrestricted internet access.

(+1) Security Testing Will Become More DNS-Aware

Modern SSRF testing will increasingly examine alternate hostname representations, redirects, IPv6, DNS changes, and other ways that a destination can differ from its original textual representation.

Final Takeaway: The Address Is Not the Destination

The most important lesson from this security issue is remarkably simple: never assume that filtering a string means you have secured the destination behind that string.

169.254.169.254 is only one example of a much broader problem.

Attackers can manipulate the layers between user input and a network connection. DNS can translate names into addresses. Redirects can change destinations. Multiple records can produce different connection targets. Dynamic DNS can alter resolution. IPv6 introduces additional representations. Proxies can further complicate the picture.

For defenders, the answer is not to memorize every hostname trick attackers might use.

The answer is to build systems that do not depend on those tricks being absent.

Resolve the destination.

Validate the resulting addresses.

Control protocols and ports.

Recheck redirects.

Account for IPv4 and IPv6.

Restrict outbound network access.

Protect cloud metadata services.

Monitor DNS and network telemetry.

And, above all, apply defense in depth.

Because when an application can be convinced to make a request on someone else’s behalf, the real security boundary is not the URL the attacker typed—it is the destination your infrastructure ultimately connects to.

🕵️‍📝Let’s dive deep and fact‑check.

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

References:

Reported By: isc.sans.edu
Extra Source Hub (Possible Sources for article):
https://stackoverflow.com
Wikipedia
OpenAi & Undercode AI

Image Source:

Unsplash
Undercode AI DI v2

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow UndercodeNews & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin | 🦋BlueSky | 🐘Mastodon | 📺Youtube