First Steps
- Confirmed issue not posted previously.
- Confirmed wiki does not contain answers.
- Checking FAQ.
- BeEF Version: Latest
- Ruby Version: 3.4.7
- Browser Details: Firefox
- Operating System: macOs
Configuration
- BeEF configuration changes? No
- 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.
First Steps
Configuration
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.createcallsitesError Description
modules/network/get_ntop_network_hosts/module.rb:34callsNetworkHost.createwith aport:keyword, but thenetwork_hoststable has noportcolumn. The migration atcore/main/ar-migrations/013_create_network_host.rbdeclares the columns as:ip, hostname, ntype, os, mac, lastseen, hooked_browser_id.Error line:
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 isntype. Discovered while reviewing my own PR for those two issues. Different attribute (port:instead oftype:), different module, same shape.Suggested Fix
Drop the
port:kwarg from theNetworkHost.createcall. NetworkHost has no port column.