Vulnerabilities in pkg:golang/github.com/almeidapaulopt/tsdproxy

PACKAGE
Advisory Summary

GHSA-pqg7-v6wh-3pfp is a HIGH (CVSS 8.5) x-forwarded-for header injection allows ip vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting TsDProxy libraries in the Go ecosystem. The issue involves x-forwarded-for header injection allows ip spoofing in proxied requests to backend services. Remediation is available in the latest vendor maintenance releases.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/almeidapaulopt/tsdproxy

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/almeidapaulopt/tsdproxy. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-pqg7-v6wh-3pfp - HIGH TsDProxy: X-Forwarded-For header injection allows IP spoofing in proxied requests to backend services
GHSA-g936-7jqj-mwv8 - CRITICAL TSDProxy: Internal proxy auth token forwarded to backend services enables management API escalation

GHSA-pqg7-v6wh-3pfp at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-pqg7-v6wh-3pfp
Severity HIGH
CVSS v3.1 Base Score 8.5
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product TsDProxy
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-pqg7-v6wh-3pfp

To remediate this vulnerability, upgrade all affected TsDProxy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/almeidapaulopt/tsdproxy fixed: Latest secure release
Upgrade github.com/almeidapaulopt/tsdproxy to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/almeidapaulopt/tsdproxy

How to Check if You Are Affected

To determine whether your application is affected by GHSA-pqg7-v6wh-3pfp, inspect your project dependencies for TsDProxy:

inspect dependencies for github.com/almeidapaulopt/tsdproxy

Analyze the terminal output to locate any version of TsDProxy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In TsDProxy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Description The HTTP reverse proxy handler in tsdproxy does not strip the X-Forwarded-For (or X-Real-IP) header from incoming requests before calling r.SetXForwarded(). This allows an authenticated Tailscale user to inject arbitrary X-Forwarded-For values that are forwarded verbatim to backend services. ```go // internal/proxymanager/port.go -- Rewrite function Rewrite: func(r *httputil.ProxyRequest) { r.SetURL(pconfig.GetFirstTarget()) r.Out.Host = r.In.Host // Strips tsdproxy identity headers (correct) r.Out.Header.Del(consts.HeaderID) r.Out.Header.Del(consts.HeaderRemoteUser) r.Out.Header.Del(consts.HeaderXForwardedUser) // ... other identity headers deleted ... // X-Forwarded-For is NOT deleted before SetXForwarded! // X-Real-IP is NOT deleted at all! r.SetXForwarded() // APPENDS client IP to attacker-controlled XFF list }, ``` Per Go's httputil.ProxyRequest.SetXForwarded() documentation: > If the inbound request has an existing X-Forwarded-For header, SetXForwarded appends the inbound request's remote address to the list. Result when attacker sends X-Forwarded-For: 127.0.0.1: - Backend receives: X-Forwarded-For: 127.0.0.1, <real-tailscale-client-ip> - If backend reads first element as "original client", attacker appears as 127.0.0.1 X-Real-IP is not handled at all -- if the attacker sets X-Real-IP: 127.0.0.1, it is forwarded to the backend verbatim without any overriding or stripping. Many backend applications trust the first element of X-Forwarded-For (or X-Real-IP) for: - IP-based access control (admin panels restricted to 127.0.0.1) - Rate limiting tied to source IP - Audit logging - Geo-blocking or network-segment restrictions This is particularly impactful in tsdproxy's intended use case where the backend service is only accessible through tsdproxy -- making the proxy's header handling the sole enforcement point. ## CVSS CVSS v3.1: AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N = 7.7 ## Severity High ## Affected Code / Files - `internal/proxymanager/port.go` -- newPortProxy Rewrite closure - Missing: r.Out.Header.Del("X-Forwarded-For") before r.SetXForwarded() - Missing: r.Out.Header.Del("X-Real-IP") unconditional strip ## Steps to Reproduce 1. Deploy tsdproxy with a backend service that restricts /admin to 127.0.0.1 via X-Forwarded-For (e.g., Nginx with real_ip_header X-Forwarded-For and real_ip_recursive on) 2. As an authenticated Tailscale user (non-admin), make a request through the proxy: ```bash curl -H "X-Forwarded-For: 127.0.0.1" \ https://<proxy-hostname>.ts.net/admin ``` 3. Backend receives: X-Forwarded-For: 127.0.0.1, <your-tailscale-ip> 4. Nginx real_ip_recursive resolves left-most non-trusted IP; if tailscale range is the only trusted range, 127.0.0.1 becomes the "real" IP, bypassing admin restriction. For the X-Real-IP vector: ```bash curl -H "X-Real-IP: 127.0.0.1" \ https://<proxy-hostname>.ts.net/admin # Backend receives X-Real-IP: 127.0.0.1 verbatim ``` ## PoC Script (if used) ```bash #!/bin/bash # Demonstrate XFF injection through tsdproxy PROXY_HOST="${1}" # e.g. myapp.my-tailnet.ts.net curl -v \ -H "X-Forwarded-For: 127.0.0.1" \ -H "X-Real-IP: 127.0.0.1" \ "https://${PROXY_HOST}/" # Expected: backend sees XFF: 127.0.0.1, <tailscale-ip> # backend sees X-Real-IP: 127.0.0.1 (unmodified) ``` ## Impact An authenticated Tailscale user who should only have regular user access can: 1. Bypass IP-based admin restrictions on the backend application by spoofing X-Forwarded-For to 127.0.0.1 2. Appear as any arbitrary IP address in audit logs 3. Bypass rate limiting tied to source IP 4. Bypass geo-blocking or network-segment restrictions enforced by the backend This is especially impactful because tsdproxy is designed as the sole access point for backend services that are otherwise network-isolated -- making the proxy the only enforcement boundary. Fix: Add r.Out.Header.Del("X-Forwarded-For") and r.Out.Header.Del("X-Real-IP") in the Rewrite closure before calling r.SetXForwarded(). This ensures only the real Tailscale client IP appears in the XFF chain. ### Credits Reported by Vishal Shukla (@shukla304) using sechub.dev AI Agent ### Support If this disclosure work has been useful, [sponsoring](https://github.com/sponsors/therawdev) helps fund continued open-source security audits -- appreciated either way.

GHSA-pqg7-v6wh-3pfp Affected TsDProxy Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/almeidapaulopt/tsdproxy
Go

References

Frequently Asked Questions

What is GHSA-pqg7-v6wh-3pfp?
GHSA-pqg7-v6wh-3pfp is a security vulnerability in TsDProxy involving X-Forwarded-For header injection allows IP spoofing in proxied requests to backend services under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which TsDProxy versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/almeidapaulopt/tsdproxy.
What version fixes GHSA-pqg7-v6wh-3pfp?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/almeidapaulopt/tsdproxy affected?
Yes, github.com/almeidapaulopt/tsdproxy is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of GHSA-pqg7-v6wh-3pfp?
GHSA-pqg7-v6wh-3pfp has a CVSS v3.1 base score of 8.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N.
What CWE is associated with GHSA-pqg7-v6wh-3pfp?
GHSA-pqg7-v6wh-3pfp is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check Go dependencies for GHSA-pqg7-v6wh-3pfp?
Run the dependency tree command: 'inspect dependencies for github.com/almeidapaulopt/tsdproxy'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-pqg7-v6wh-3pfp",
  "modified" : "2026-07-14T19:46:15Z",
  "published" : "2026-07-14T19:46:15Z",
  "aliases" : [ ],
  "summary" : "TsDProxy: X-Forwarded-For header injection allows IP spoofing in proxied requests to backend services",
  "details" : "## Description\n\nThe HTTP reverse proxy handler in tsdproxy does not strip the X-Forwarded-For (or X-Real-IP) header from incoming requests before calling r.SetXForwarded(). This allows an authenticated Tailscale user to inject arbitrary X-Forwarded-For values that are forwarded verbatim to backend services.\n\n```go\n// internal/proxymanager/port.go -- Rewrite function\nRewrite: func(r *httputil.ProxyRequest) {\n    r.SetURL(pconfig.GetFirstTarget())\n    r.Out.Host = r.In.Host\n\n    // Strips tsdproxy identity headers (correct)\n    r.Out.Header.Del(consts.HeaderID)\n    r.Out.Header.Del(consts.HeaderRemoteUser)\n    r.Out.Header.Del(consts.HeaderXForwardedUser)\n    // ... other identity headers deleted ...\n\n    // X-Forwarded-For is NOT deleted before SetXForwarded!\n    // X-Real-IP is NOT deleted at all!\n    r.SetXForwarded()  // APPENDS client IP to attacker-controlled XFF list\n},\n```\n\nPer Go's httputil.ProxyRequest.SetXForwarded() documentation:\n> If the inbound request has an existing X-Forwarded-For header, SetXForwarded appends the inbound request's remote address to the list.\n\nResult when attacker sends X-Forwarded-For: 127.0.0.1:\n- Backend receives: X-Forwarded-For: 127.0.0.1, <real-tailscale-client-ip>\n- If backend reads first element as \"original client\", attacker appears as 127.0.0.1\n\nX-Real-IP is not handled at all -- if the attacker sets X-Real-IP: 127.0.0.1, it is forwarded to the backend verbatim without any overriding or stripping.\n\nMany backend applications trust the first element of X-Forwarded-For (or X-Real-IP) for:\n- IP-based access control (admin panels restricted to 127.0.0.1)\n- Rate limiting tied to source IP\n- Audit logging\n- Geo-blocking or network-segment restrictions\n\nThis is particularly impactful in tsdproxy's intended use case where the backend service is only accessible through tsdproxy -- making the proxy's header handling the sole enforcement point.\n\n## CVSS\nCVSS v3.1: AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N = 7.7\n\n## Severity\nHigh\n\n## Affected Code / Files\n- `internal/proxymanager/port.go` -- newPortProxy Rewrite closure\n- Missing: r.Out.Header.Del(\"X-Forwarded-For\") before r.SetXForwarded()\n- Missing: r.Out.Header.Del(\"X-Real-IP\") unconditional strip\n\n## Steps to Reproduce\n1. Deploy tsdproxy with a backend service that restricts /admin to 127.0.0.1 via X-Forwarded-For (e.g., Nginx with real_ip_header X-Forwarded-For and real_ip_recursive on)\n2. As an authenticated Tailscale user (non-admin), make a request through the proxy:\n\n```bash\ncurl -H \"X-Forwarded-For: 127.0.0.1\" \\\n     https://<proxy-hostname>.ts.net/admin\n```\n\n3. Backend receives: X-Forwarded-For: 127.0.0.1, <your-tailscale-ip>\n4. Nginx real_ip_recursive resolves left-most non-trusted IP; if tailscale range is the only trusted range, 127.0.0.1 becomes the \"real\" IP, bypassing admin restriction.\n\nFor the X-Real-IP vector:\n```bash\ncurl -H \"X-Real-IP: 127.0.0.1\" \\\n     https://<proxy-hostname>.ts.net/admin\n# Backend receives X-Real-IP: 127.0.0.1 verbatim\n```\n\n## PoC Script (if used)\n```bash\n#!/bin/bash\n# Demonstrate XFF injection through tsdproxy\nPROXY_HOST=\"${1}\"  # e.g. myapp.my-tailnet.ts.net\ncurl -v \\\n  -H \"X-Forwarded-For: 127.0.0.1\" \\\n  -H \"X-Real-IP: 127.0.0.1\" \\\n  \"https://${PROXY_HOST}/\"\n# Expected: backend sees XFF: 127.0.0.1, <tailscale-ip>\n#           backend sees X-Real-IP: 127.0.0.1 (unmodified)\n```\n\n## Impact\n\nAn authenticated Tailscale user who should only have regular user access can:\n1. Bypass IP-based admin restrictions on the backend application by spoofing X-Forwarded-For to 127.0.0.1\n2. Appear as any arbitrary IP address in audit logs\n3. Bypass rate limiting tied to source IP\n4. Bypass geo-blocking or network-segment restrictions enforced by the backend\n\nThis is especially impactful because tsdproxy is designed as the sole access point for backend services that are otherwise network-isolated -- making the proxy the only enforcement boundary.\n\nFix: Add r.Out.Header.Del(\"X-Forwarded-For\") and r.Out.Header.Del(\"X-Real-IP\") in the Rewrite closure before calling r.SetXForwarded(). This ensures only the real Tailscale client IP appears in the XFF chain.\n\n### Credits\n\nReported by Vishal Shukla (@shukla304) using sechub.dev AI Agent\n\n### Support\n\nIf this disclosure work has been useful, [sponsoring](https://github.com/sponsors/therawdev) helps fund continued open-source security audits -- appreciated either way.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/almeidapaulopt/tsdproxy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 3.0.0-alpha.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/almeidapaulopt/tsdproxy/security/advisories/GHSA-pqg7-v6wh-3pfp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/almeidapaulopt/tsdproxy/commit/e8200b7947719e5e7fbbbdb9c34f459a4c285e77"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/almeidapaulopt/tsdproxy"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-14T19:46:15Z",
    "nvd_published_at" : null
  }
}