center-for-threat-informed-defense / caldera_pathfinder

Pathfinder is a plugin for mapping network vulnerabilities, scanned by CALDERA or imported by a supported network scanner, and translating those scans into adversaries for network traversal.
https://caldera.mitre.org/
Apache License 2.0
120 stars 26 forks source link

Problem when testing nmap-vulners #26

Closed 0xWr41th closed 3 years ago

0xWr41th commented 3 years ago

I have the following error while testing pathfinder in kali.

nmap scan started with parameters:
{
    "target_specification": "192.168.0.0/24",
    "script": "nmap-vulners",
    "script_args": "",
    "ports": "",
    "pingless": "0"
}
scan initiated, depending on scope it may take a few minutes
scan ID:c3f7f452-6d21-4089-a171-7c4578c794f0 failed. error output: NSE: failed to initialize the script engine:
/usr/bin/../share/nmap/nse_main.lua:821: directory 'nmap-vulners' found, but will not match without '/'
stack traceback:
    [C]: in function 'error'
    /usr/bin/../share/nmap/nse_main.lua:821: in local 'get_chosen_scripts'
    /usr/bin/../share/nmap/nse_main.lua:1312: in main chunk
    [C]: in ?

QUITTING!
mrengstrom commented 3 years ago

When you cloned down pathfinder did you remember to use the --recursive flag to pull down the nmap-vulners subrepo? You can cd to /pathfinder/scanners/nmap/scripts/nmap-vulners to make sure that the repo pulled down successfully and it should be more than an empty directory.

I will also try and reproduce the error and see if I can get the same output.

satyendra22 commented 3 years ago

Hi, I'm also facing facing same error even all the files are installed properly from /pathfinder/scanners/nmap/scripts/nmap-vulners

can initiated, depending on scope it may take a few minutes scan ID:cef56b53-dec8-46bc-8df6-8aa4a9b6ce1c failed. error output: Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower. NSE: failed to initialize the script engine: /usr/bin/../share/nmap/nse_main.lua:821: directory 'nmap-vulners' found, but will not match without '/' stack traceback: [C]: in function 'error' /usr/bin/../share/nmap/nse_main.lua:821: in local 'get_chosen_scripts' /usr/bin/../share/nmap/nse_main.lua:1312: in main chunk [C]: in ?

QUITTING!

mrengstrom commented 3 years ago

Apologies for the delay, I found the issue and it appears to have been a change in nmap 7.9.0 that came out in october

[GH#2051] Restrict Nmap's search path for scripts and data files.
NMAPDATADIR, defined on Unix and Linux as ${prefix}/share/nmap, will not be
searched on Windows, where it was previously defined as C:\Nmap .
Additionally, the --script option will not interpret names as directory
names unless they are followed by a '/'. [Daniel Miller]

I created a PR to handle this change and will link it to this issue