Posted on Leave a comment

UNIX privesc check: Complete guide

Hello, aspiring ethical hackers. In our previous blogpost, you learnt about Linux privilege escalation. In this article, you will learn about UNIX privesc check , a tool that will help you in elevating privileges on a Linux and UNIX system.

UNIX privesc check is a shell script that checks for all simple privilege escalation vectors on a UNIX system. This script finds misconfigurations and other settings that could allow local unprivileged users to elevate privileges on a target Linux system.

Let’s see how this tool works. For this, we will be using Kali Linux as this tool is available by default in its repositories. As target system, we will be using Metasploitable 2 installed in our virtual hacking lab.

Unix Privesc Check 1

As it is a local privilege escalation script, it needs to be run on the target system. Obviously, you need to have access on the target system. Learn various methods to gain access to a Linux system in our Linux hacking article. After gaining access, we can use any method to download the UNIX-privesc-check script to the target system.

Unix Privesc Check 2

Next, it can be executed like any other shell script.

Unix Privesc Check 3

Unix privesc check runs in two modes: standard and detailed. In standard mode it performs a speed optimised check of security settings. It can be run in standard mode as shown below.

./unix-privesc-check standard
Unix Privesc Check 4

In the detailed mode, it performs all checks performed in standard mode but additionally it will also perform checks of permissions of open file handles and other files. This mode sis low but can help you find more weaknesses in 3rd party programs. UNIX privesc check can be run in detailed mode using command shown below.

./unix-privesc-ccheck detailed
Unix Privesc Check 5

It is good practice to save the scan output to a file. This can be done as shown below.

Unix Privesc Check 6

Usually this file with scanned output needs to be transferred to the attacker system for analysis. This can be done using tools like netcat or socat. For example, let’s transfer “detailed_output.txt” file to attacker system for observation. While observing the output file, you need to look out for “warning” signs. These allow in privilege escalation of Linux system.

Unix Privesc Check 7
Unix Privesc Check 8
Unix Privesc Check 9
Unix Privesc Check 10
Unix Privesc Check 11
Unix Privesc Check 12
Unix Privesc Check 13
Unix Privesc Check 14

For example, you can see that SUDO is configured in the above image.

Unix Privesc Check 15
Unix Privesc Check 16
Unix Privesc Check 17
Unix Privesc Check 18
Unix Privesc Check 19
Unix Privesc Check 20
Unix Privesc Check 21
Unix Privesc Check 22

This tool has also found one binary with SUID bit set. Learn about SETUID privilege escalation.

Unix Privesc Check 23
Unix Privesc Check 24
Unix Privesc Check 25
Unix Privesc Check 26

It has even found public and private SSH keys which can be used to login to SSH server on target system. Learn about SSH hacking in our comprehensive guide.

Unix Privesc Check 27
Unix Privesc Check 28
Unix Privesc Check 29
Unix Privesc Check 30
Unix Privesc Check 31
Unix Privesc Check 32

That’s how we use this tool. Learn about Windows privesc check, a tool that helps us in elevating privileges on a Window system.

Posted on

Beginners guide to Lynis

Hello, aspiring ethical hackers. In this blogpost, you will learn about a tool called Lynis, the security auditing and hardening tool for UNIX based systems like Linux, macOS, BSD and others. It performs an in-depth security scan to test security defenses and provide suggestions for further system hardening.

This tool audits the following features on the system.

  1. General system information.
  2. System tools.
  3. Operating system.
  4. Boot and other services.
  5. Kernel vulnerabilities.
  6. Memory and processes.
  7. Users, groups and authentication
  8. Kerberos
  9. Shells
  10. File systems
  11. USB devices
  12. Storage
  13. NFS
  14. Name Services
  15. Ports and packages
  16. Networking
  17. Printers and Spool
  18. Email and messaging software
  19. Firewalls
  20. Web servers
  21. SSH and SNMP
  22. Databases
  23. PHP (in web server)
  24. Logging and log files
  25. Insecure services
  26. Banners
  27. Scheduled Tasks
  28. Accounting
  29. Time and synchronization
  30. Cryptography
  31. Virtualization
  32. Containers
  33. Security frameworks
  34. System tools and malware
  35. File permissions etc.

Let’s see how to run Lynis for the first time. For this, we will be using Kali Linux. It can be installed on Kali as shown below.

Lynis 1

After the installation is successful, run the command shown below to run it to audit the entire system.

lynis audit system
Lynis 2

It runs as shown below.

Lynis 3

While auditing, wherever there is scope for hardening, lynis adds a suggestion as shown below.

Lynis 4
Lynis 5
Lynis 6
Lynis 7

After the entire system is audited, Lynis provides summary of the entire audit as shown below.

Lynis 11
Lynis 12
Lynis 13

Below the summary, you can find each suggestion as shown below.

Lynis 8
Lynis 9
Lynis 10

You can harden your system based on these suggestions. You can also find this information in the log reports of Lynis.

Lynis 14
Lynis 15
Lynis 16
Lynis 17

Posted on

Beginners guide to Eyewitness tool

Hello aspiring ethical hackers. In our previous blogpost, you studied about website footprinting. In this blogpost, you will learn about a tool called eyewitness which helps you to decide which website to focus on.

In ethical hacking, before trying to footprint a website, it would be good if we have a general idea about what websites to target first. For example, a company you are going to pen test may have multiple websites and sub domains. Before we jump into password cracking or exploitation or directory busting or perform any other attack, it would be good if we are first able to decide what website and URLs to target first. The role of eyewitness tool comes there. Eyewitness takes the screenshots of the URLs or websites you provide. Apart from taking screenshot of the URL, it will also capture any header info and default passwords.

Let’s see how to use this tool. For this we will be using Kali Linux as this tool is available by default in Kali repositories. As target, we will be using Metasploitable 2 installed in our virtual hacking Lab. It can be installed as shown below.

Eyewitness 1 1

Target a single URL (–single)

You can take screenshot of a single URL as shown below.

Eyewitness 2

As soon as it writes a report for your target, it will ask you if you want to open the report. Click on “Yes”. It will open the report as shown below.

Eyewitness 3

You can even view the code of the URL you scanned.

Eyewitness 4
Eyewitness 5

But the real power of eyewitness can be seen when we are targeting multiple URLs at once. For doing this, we will first create a file called URLS.txt and add some URLs we want to target as shown below.

Eyewitness 6

Target multiple URLs (-f)

Multiple URLs can be targeted with this tool by specifying the above created file with (-f) option.

Eyewitness 7
Eyewitness 8

Here’s the report.

Eyewitness 9
Eyewitness 10
Eyewitness 11
Eyewitness 12

One of our URLs we targeted ended up in a error.

Eyewitness 13

Skip DNS resolution(–no-dns)

In some cases, while using eyewitness tool, you may have to go through a VPN. In such cases, it is good to skip DNS resolution when connecting to the website. This option helps you to do it.

Eyewitness 14

Resolve IP / host name for your target (–resolve)

Eyewitness 15

Time to wait while requesting an URL (–timeout)

By default, eyewitness waits for 7 seconds before it goes to take a screenshot of a new webpage. However, this can be changed with this option. For example, let’s change the timeout time to 1 second.

Eyewitness 16

Add jitter (–jitter)

Using this option, we can randomize the URLs specified and add a random delay.

Eyewitness 17
Eyewitness 18

Add delay before taking a screenshot (–delay)

Using the option, we can add delay between opening of the navigator and taking a screenshot. This delay can be specified in seconds. For example, let’s add 10 seconds delay before taking screenshot.

Eyewitness 19
Eyewitness 20

Maximum retries (–max-retries)

This option specifies eyewitness tool how many retries it has to make if it fails to grab a screenshot on the first attempt.

Eyewitness 21

Specify directory name for saving the report (-d)

This option is used to specify a directory name for saving the report.

Eyewitness 22

Number of results to show on one page (–results)

By default, eyewitness shows output for all the URLs given as input on a single page. This option can be used to specify how many results to show per page. For example, let’s set it to show 1 result per page.

Eyewitness 23
Eyewitness 24

As you can see, now, all the results are shown on separate pages.

You don’t want to be prompted for viewing the report (–no-prompt)

If you don’t want eyewitness to prompt you to open the report after finishing its work, you can use this option.

Eyewitness 25
Eyewitness 26