Connection Pool Examples

Sekaictf2022 - safelist

In the Sekaictf2022 - safelist challenge, @Strellic_ gives an example of how to use a variation of the Connection Pool technique to perform a XS-Leak.

In this challenge, the goal is to exfiltrate a flag that will appear in the bots web session inside a post. These are the assets the attacker has:

  • The bot will visit a URL given by the attacker

  • The attacker can inject HTML in the page (but no JS, dompurify is used) abusing a CSRF making the bot create a post with that HTML.

  • The attacker can abuse a CSRF to make the bot delete the first post inside the web.

  • Because the posts are ordered alphabetically, when the first post is deleted, if the HTML content of the attacker is loaded means that it was alphabetically before the flag.

Therefore, to steal the flag, the solution proposed by @Strellyc_ is to, for each char to test make the bot:

  • Create a new post that starts with the known part of the flag and several img loads.

  • Delete the post in position 0.

  • Block 255 sockets.

  • Load the page with the posts

  • Perform 5 random requests to a site (example.com in this case) and measure the time this takes.

Exploit 1

This is the exploit code, taken from https://github.com/project-sekai-ctf/sekaictf-2022/blob/main/web/safelist/solution/solve.html:

Exploit 2

Same tactic but different code from https://blog.huli.tw/2022/10/05/en/sekaictf2022-safelist-xsleak/

DiceCTF 2022 - carrot

In this case the first step of the exploit was to abuse a CSRF to modify the page where the flag is contained so it has much more content (and therefore loading it takes more time), and then abuse the connection pool to measure the time it takes to access the page that could be potentially having the flag.

In the exploit you can see:

  • Abuse CSRF

  • Occupy all the sockets but 1

  • Calibrate the response

  • Start bruteforcing by accessing the potential page with the flag

    • The potential page will be accessed and immediately an attackers controlled URL will also be accessed to check how much time both requests take.

Last updated