Go Trust Proxy On
Description
This detector identifies insecure proxy configuration in Gin web framework applications where SetTrustedProxies is called with wildcard values (like "*" or "0.0.0.0/0"). This misconfiguration allows any proxy to be trusted, potentially enabling IP spoofing attacks where malicious actors can manipulate client IP addresses and bypass security controls.
Detection Strategy
• Code must import the Gin web framework library (github.com/gin-gonic/gin)
• File being analyzed must not be a test file
• Code contains a method call ending with 'SetTrustedProxies'
• The first argument to SetTrustedProxies contains wildcard proxy definitions that would trust all proxies indiscriminately
Vulnerable code example
package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func VulnerableProxy() *gin.Engine {...✅ Secure code example
package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func VulnerableProxy() *gin.Engine {...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.