Skip to content

Security: trust_header overwrites req.RemoteAddr globally #4

@adryd325

Description

@adryd325

When trust_header is configured, req.RemoteAddr is overwritten. This allows spoofing the remote address in following checks.

In the example the {remote_host} variable is changed.

geo_ip {
        db_path /var/lib/GeoIP/GeoLite2-City.mmdb
        trust_header X-Forwarded-For
}

respond /test 200 {
        body "Remote Address:{remote_host}"
}

This allows bypassing IP range restrictions, bypassing the trusted_proxy directive in reverse_proxy and any other restrictions or checks that use req.RemoteAddr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions