Skip to content
SSRF Write-up Intermediate

Bypassing blacklists based on IPy

The IPy library misclassified octal-encoded IP addresses as PUBLIC, allowing a blacklist that relied on IPy to be bypassed. An attacker could use such an address to reach private or internal IPs that the filter intended to block.

Nicolas Grégoire Follow

Published on agarri.fr

Bounty$500total stated by author View original

A few months ago, when working on my slides for Insomni'hack, I had a few conversations with the Prezi security team. Among many defense-in-depth protections, they introduced some code forbidding access to private IP addresses.

Nicolas Grégoire (@Agarri_FR), on agarri.fr

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 IPy library's iptype() function only recognised certain textual IP formats and fell back to 'PUBLIC' for unrecognised ones, while urllib2 accepted those same formats and resolved them to private addresses.

Impact

An attacker could bypass the private-IP blacklist and make the server access internal addresses, though the real impact was near null in Prezi's setup due to defence in depth.

What the attacker needed

Application uses IPy for IP blacklisting; attacker can supply a URL to the application

The fix

Prezi patched their own filter, and the report suggests explicitly checking for 'PUBLIC' instead of relying on IPy's fallback behaviour.

How it was found

  1. Take a private IP address and write it in octal dotted format.
  2. Pass the octal address to IPy's iptype() and observe it returns PUBLIC.
  3. Use the same octal address in a URL processed by urllib2, which resolves it to the private IP.
  4. The blacklist check passes because IPy said PUBLIC, and the request reaches the private address.

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 blacklist is a list of addresses a program refuses to visit. The program used a library called IPy to decide if an address was private, but IPy did not understand some ways of writing the same address, so it said 'public' when it was actually private. That let an attacker sneak past the check.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More by Nicolas Grégoire

View all

8 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.