Skip to content

get_ntop_network_hosts: NetworkHost.create called with non-existent port: attribute #3573

Description

@sethumadh

First Steps

  1. Confirmed issue not posted previously.
  2. Confirmed wiki does not contain answers.
  3. Checking FAQ.
  4. BeEF Version: Latest
  5. Ruby Version: 3.4.7
  6. Browser Details: Firefox
  7. Operating System: macOs

Configuration

  1. BeEF configuration changes? No
  2. Enabled/disabled extensions? No

Steps to Reproduce

I do not have an ntop instance available to reproduce this end-to-end. Therefore i did not reproduce running the module.

How this was found

Static code review during the fix for PR for #3493 and #3498. While revewing every NetworkHost.create / NetworkService.create callsites

Error Description

modules/network/get_ntop_network_hosts/module.rb:34 calls NetworkHost.create with a port: keyword, but the network_hosts table has no port column. The migration at core/main/ar-migrations/013_create_network_host.rb declares the columns as: ip, hostname, ntype, os, mac, lastseen, hooked_browser_id.

Error line:

# modules/network/get_ntop_network_hosts/module.rb:34
BeEF::Core::Models::NetworkHost.create(hooked_browser_id: session_id, ip: ip, port: port)

Expected error at runtime:
I couldn't trigger this end-to-end because I don't have an ntop instance to scan, but the bug is statically obvious from the code combined with the migration.

This is the same family of bug as #3493 and #3498, which reported type: being passed to NetworkHost/NetworkService where the column is ntype. Discovered while reviewing my own PR for those two issues. Different attribute (port: instead of type:), different module, same shape.

Suggested Fix

Drop the port: kwarg from the NetworkHost.create call. NetworkHost has no port column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions