> For the complete documentation index, see [llms.txt](https://alirodoplu.gitbook.io/ali-rodoplu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alirodoplu.gitbook.io/ali-rodoplu/offensive/enum4linux.md).

# Enum4Linux

<figure><img src="https://2451201392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXlq8GYyAbVnvbRZogU3%2Fuploads%2FQQRCC0A7gaRkkt40RIQi%2Fimage.png?alt=media&amp;token=75a9a55f-6d72-4d7c-8853-971c2390e916" alt="" width="384"><figcaption><p><em>Image Source:</em><a href="https://www.kali.org/tools/enum4linux/"><em>https://www.kali.org/tools/enum4linux/</em></a></p></figcaption></figure>

{% hint style="warning" %}
Use what I'm about to say in this article only for the right purposes, such as raising security awareness and improving the security posture of your environments. I do not accept any responsibility for other uses.
{% endhint %}

Enum4Linux is a tool used to collect information from Windows and Samba systems. Some information that Enum4Linux can collect;

&#x20;     ->Shared files and directories of the target system, \
&#x20;     ->Working users and groups of the target system, \
&#x20;     ->NetBIOS name and IP address of the target system, \
&#x20;     ->Operating system version of the target system, \
&#x20;     ->Security settings of the target system.

Enum4linux is a tool written in Perl language used in collecting information in penetration tests. So let's talk about how we can use it.

### Requirements

&#x20;     -> Kali Linux\
&#x20;     ->Metasploitable

First of all, deploy ***Metasploitable***, a vulnerable Linux variant, to your environment. Metasploitable's default username and password is "*<mark style="color:yellow;">**msfadmin**</mark>*". Log in with this information.

<figure><img src="https://2451201392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXlq8GYyAbVnvbRZogU3%2Fuploads%2F7iwLyUOEdVbeiAoFhuPV%2Fimage.png?alt=media&amp;token=f43418c8-b8a6-4824-90b4-03f34a9fb18b" alt="" width="540"><figcaption><p><em>Metasploitable Terminal</em></p></figcaption></figure>

Metasploitable does not have a graphical interface by default and I used Metasploitable in one of my previous articles, "[***Exploiting the Shellshock Vulnerability and Protecting Yourself against It***](/ali-rodoplu/offensive/exploiting-the-shellshock-vulnerability-and-protecting-yourself-against-it.md)", where I explained another vulnerability, the Shellshock vulnerability.

Let's see which ports are open by starting an nmap scan from our Attacker machine.

```bash
nmap -Pn <Target-IP>
```

<figure><img src="https://2451201392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXlq8GYyAbVnvbRZogU3%2Fuploads%2FVcg6PmIQsRe610apXALX%2Fimage.png?alt=media&amp;token=4e2148f3-e0ea-4bbf-86c1-b5552ad51ae7" alt="" width="563"><figcaption></figcaption></figure>

As we see, our SMB ports are open on the target machine. This means that we can continue to look for vulnerabilities in these ports with enum4linux.

The *<mark style="color:yellow;">**-U**</mark>* parameter is used to list the users on the target.

```bash
enum4linux -U <Target-IP>
```

<figure><img src="https://2451201392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXlq8GYyAbVnvbRZogU3%2Fuploads%2FjiM8yUH96gdvdntpn22h%2Fimage.png?alt=media&amp;token=ba6f8ba5-b62f-4b40-8d93-f5e45897e903" alt="" width="563"><figcaption><p><em>Kali Terminal</em></p></figcaption></figure>

We can see the status of shared environments by using the *<mark style="color:yellow;">**-S**</mark>* parameter.

```bash
enum4linux -S <Target-IP>
```

<figure><img src="https://2451201392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXlq8GYyAbVnvbRZogU3%2Fuploads%2FlhG3hBvwoHRSgNgj59w3%2Fimage.png?alt=media&amp;token=291d9ac4-a9eb-4a34-a783-33a152f55cd9" alt=""><figcaption><p><em>Kali Terminal</em></p></figcaption></figure>

As you can see, we understand that we have access to the *<mark style="color:yellow;">**\<Target-IP>/tmp**</mark>* directory and have permission to list it.

We can see the status of password policy informations by using the *<mark style="color:yellow;">**-P**</mark>* parameter.

```bash
enum4linux -P <Target-IP>
```

<figure><img src="https://2451201392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXlq8GYyAbVnvbRZogU3%2Fuploads%2F5TwzJziRvN91An7uON3S%2Fimage.png?alt=media&amp;token=5e292a8d-90cc-4dd6-8ef8-c1daa1959f69" alt=""><figcaption><p><em>Kali Terminal</em></p></figcaption></figure>

We can check the status of NetBIOS  services using the *<mark style="color:yellow;">**-n**</mark>* parameter.

```bash
enum4linux -n <Target-IP>
```

<figure><img src="https://2451201392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXlq8GYyAbVnvbRZogU3%2Fuploads%2FAR2ohQTygTSr5ooW3EBn%2Fimage.png?alt=media&amp;token=bc2800d4-c638-4b62-86cc-8dbf27dfbdf2" alt=""><figcaption><p><em>Kali Terminal</em></p></figcaption></figure>

We can check the all SIDs using the *<mark style="color:yellow;">**-r**</mark>* parameter.

```bash
enum4linux -r <Target-IP>
```

<figure><img src="https://2451201392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXlq8GYyAbVnvbRZogU3%2Fuploads%2FUGIjNZYDAk5Wj4tEbabl%2Fimage.png?alt=media&amp;token=2d10882b-e8c3-4b6a-9ce7-703d097baea7" alt=""><figcaption><p><em>Kali Terminal</em></p></figcaption></figure>

### **What needs to be done to avoid such scanning and information acquisition attacks;**

->Turn off unused services,\
->Staying away from vulnerable protocols,\
->Use strong passwords,\
->Delete unnecessary users from the system,

### **Resources Used**

<https://null-byte.wonderhowto.com/how-to/enumerate-smb-with-enum4linux-smbclient-0198049/>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://alirodoplu.gitbook.io/ali-rodoplu/offensive/enum4linux.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
