laststance / laststance/gitbox

x-forwarded-for first-IP spoofing on Vercel

Open
#182 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2-medium security
Dominant language
TypeScript
Stars
5
Forks
2
Avg merge
6h 9m
Merged PRs (30d)
2

Description

Summary

getForwardedClientIp takes split(',')[0], which on Vercel can be attacker-controlled.

Source

P2 follow-up from /ship adversarial review of PR #176 (silent GitHub token refresh).

Details

On Vercel, x-forwarded-for is appended to (not replaced), so the first hop is the client-controllable value. Bypass is rate-limit-only and requires authenticated session, but it still defeats per-IP throttling.

Fix

Switch to x-real-ip (Vercel-set) or read the LAST entry of x-forwarded-for.

Acceptance

  • IP extraction uses trusted edge-set header
  • Tests cover spoofed x-forwarded-for chains
  • No rate-limit bypass via header injection

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The entry point is getForwardedClientIp; first inspect how it handles x-forwarded-for and the Vercel x-real-ip option. Add tests for spoofed x-forwarded-for chains and verify that IP extraction uses the trusted value without allowing a rate-limit bypass.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.