Skip to content

Review "IP address has changed" functionality #2821

@bcoles

Description

@bcoles

The "IP address has changed" functionality is dodgy. Worse, when allow_reverse_proxy is used, the X-Forwarded-For header is trusted implicitly without validation.

# @note Check for a change in zombie IP and log an event
if config.get('beef.http.allow_reverse_proxy') == true
if hooked_browser.ip != request.env['HTTP_X_FORWARDED_FOR']
BeEF::Core::Logger.instance.register('Zombie', "IP address has changed from #{hooked_browser.ip} to #{request.env['HTTP_X_FORWARDED_FOR']}", hooked_browser.id.to_s)
hooked_browser.ip = request.env['HTTP_X_FORWARDED_FOR']
end
elsif hooked_browser.ip != request.ip
BeEF::Core::Logger.instance.register('Zombie', "IP address has changed from #{hooked_browser.ip} to #{request.ip}", hooked_browser.id.to_s)
hooked_browser.ip = request.ip
end

Here's an example someone provided, showing that the stored IP address contains two IP addresses separated by ,.

image

It may also result in many "IP address has changed" events in load balanced environments. Although I'm not sure that this is avoidable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions