Nikto Cheat Sheet

  • Hacking/OSCP Cheatsheet
    • Enumeration
      • Network discoverie
      • Ports discovery (without nmap)
      • Banner grabbing (without nmap)
      • Web directorie/file scanner
      • Samba
    • Exfiltration
      • Samba
      • HTTP
    • Pivoting
      • sshuttle
    • Reverse shells
    • Privilege escalation
      • Windows
      • Linux
    • Good to know (either Windows and/or Linux)
    • Simple Buffer Overflow (32 bits, NO ASLR and NO DEP)
      • Usefull tools (on Kali Linux)

Well, just finished my 90 days journey of OSCP labs, so now here is my cheatsheet of it (and of hacking itself), I will be adding stuff in an incremental way as I go having time and/or learning new stuff.But this is basically the tools I tend to relie and use in this way the most.Hope is helpfull for you!

Enumeration

Network discoverie

JustTryHarder, a cheat sheet which will aid you through the PWK course & the OSCP Exam. (Inspired by PayloadAllTheThings) Feel free to submit a Pull Request & leave a star to share some love if this helped you. Nikto Cheat sheet. All of these attacks are against the Metasploitable 2 vulnerable operating system. Metasploitable2 Download. Scanning a host. This cheat sheet is designed to give you quick facts to remember on test day to help you answer questions found on the CompTIA PenTest+ certification exam. Use this cheat sheet to review. NMAP Commands Cheat Sheet and Tutorial with Examples (Download PDF) NMAP (Network Mapper) is the de facto open source network scanner used by almost all security professionals to enumerate open ports and find live hosts in a network (and much more really). One of my responsibilities in my job is to perform white hat penetration testing and security assessments.

Nikto Cheat Sheet It's hard to believe the power you can command within seconds of installing this command-line tool. Nikto is a web server assessment tool, designed to identify and analyze various default and insecure files, configurations, and programs on just about any type of web server.

Nmap

I tend to run 3 nmaps, an initial one, a full one and an UDP one, all of them in parallel:

Is also possible to specify scripts or ports:

If there are servers that could be not answering (ping), then add the flag -Pn (example of initial one):

Ports discovery (without nmap)

nc + bash

If you get in a machine that doesn’t have nmap installed, you can do a basic discovery of (for example), top 10 ports open in 192.168.30 by doing:

/dev/tcp/ip/port or /dev/udp/ip/port

Alternatively, is possible to do the same than above but by using the special dev files /dev/tcp/ip/port or /dev/udp/ip/port (for example nc is not found):

Taking these last examples, is straightforward to create a dummy script for scan a hole /24 net (for example):

Banner grabbing (without nmap)

If nmap didn’t grab banners (or is not installed), you can do it with /dev/tcp/ip/port/dev/udp/ip/port or by using telnet.

/dev/tcp/ip/port or /dev/udp/ip/port

For doing it with udp ports is the same, but changing tcp for udp

telnet

Web directorie/file scanner

Gobuster

Scan all the directories/files by extension:

For scanning without extensions, just take out the -x

Nikto

Sometimes Nikto shows juicy information, I tend to run it like:

fuff

Web fuzzer, you can get fuff here, it basically bruteforces the dirs.

Most usefull dictionaries (OSCP/HTB)

Samba

smbclient

Check if there is anonymous login enabled:

impacket

Is also possible to use impacket in the same way than smbclient to check for anonymous login (and a lot more as browse the shares) in case of incompatible versions.

smbmap

Check which permissions we have in those shares (if there are):

Version (nmap didn’t detect it)

Nikto Cheat Sheet 2019

Sometimes nmap doesn’t show the version of Samba in the remote host, if this happens, a good way to know which version the remote host is running, is to capture traffic with wireshark against the remote host on 445/139 and in parallel run an smbclient -L, do a follow tcp stream and with this we might see which version the server is running.

Exfiltration

Samba

Generate a samba server with Impacket:

Mount in Windows

Mounting it in Windows with Powershell:

Mounting it without Powershell:

On windows, to list mounted shares, either Powershell or without it:

Mount in Linux

Is needed to have installed cifs-utils, to install it (in debian based):

To mount it:

To list mounted shares:

HTTP

From your local attacker machine, create a http server with:

It’s also possible to specify which path to share, for example:

Windows

Linux

FTP

If there is an ftp server which we have access, we can upload files there through it, the ' is the same for both, windows or linux:

Sockets

Using nc/ncat is possible to create as a listener to upload/download stuff through them, the syntax for nc and ncat is basically the same.Create the socket with:

RDP

If we have access to a windows machine with a valid user/credentials and this user is in the “Remote Desktop Users”, we can share a local directorie as a mount volume through rdp itself once we connect to the machine:

Pivoting

It’s possible to do pivoting by using proxychains, pure nc’s or in case of linux just some fifo files (I will write them down this another methods down maybe in a future), I have used during all the OSCP an awesome tool called (sshuttle)[https://github.com/sshuttle/sshuttle] (it’s a transparent proxy server that works like “a vpn”, and doesn’t require with super rights, only thing needed is that the bastion server you will use, needs to have installed python) and sometimes some SSH Forwarding. Something worth to mention nmap doesn’t work through sshuttle.

sshuttle

One hop

Let’s say we are in an intranet and we have compromised a firewall that gives us access to the management net (fw.example.mgmt - ips 192.168.20.35 and 192.168.30.253 as the management ip), by using sshuttle we can create a “vpn” to talk directly to those servers, for that, we use:

Multi-hops

Now imagine that after we broke up into the management net after some some enumeration, we ended to compromise a machine that has also access to a production environment (foreman.example.mgmt - ips 192.168.30.40 and 192.168.25.87), we can take advantage of sshuttle + ProxyCommand of ssh to create a “vpn” through this multiple hops, so…putting it down, this will be kind of as follow (the diagram is extremly simplified and just for the sake of illustrate this visually, so it doesn’t intend to provide a 100% precise network diagram):

To have that working, is needed to put the next conf in your ssh conf file (normally ~/.ssh/config. It’s based on the example above, but is easy to extrapolate to different scenarios):

And now to setup the “multiple hop vpn”, run:

Reverse shells

php

bash

Nikto Cheat Sheet

sh + nc

Perl (example deploy as cgi-bin)

Java (example to deploy on tomcat)

Windows HTPP download reverse shell

Windows staged reverse TCP

Windows stageless reverse TCP

Linux staged reverse TCP

Linux staged reverse TCP

Nikto Cheat Sheet Download

Privilege escalation

Windows

Run-As

Sheet

Incorrect permisions in services (sc config binpath)

Binpath is set as running cmd.exe passing a commad to execute to it (so once the process dies, the one executed by it so the command to cmd.exe remains):

SAM + SYSTEM + Security

If those 3 files are in your hands (you could download to your attacker machine), you can dump hashes and crack them:

Nikto Cheat Sheet

Linux

/home/user/openssl =ep (empty capabilities)

Make 2 copies of passwd, one as backup of the original, and one that will be used as custom:

Now, a custom user will be created and added to /tmp/passwd.custom with customPassword and as root user (UID = GID = 0):

Now, create a custom key.pem and cert.pem with openssl:

Encrypt the new custom passwd:

Now, decrypt the custom passwd overwritting in the process the real one (/etc/passwd):

And finally, just login with the user created with root privileges by using customPassword:

Command web injection: add user

Nikto Cheat Sheet Free

NFS; no_root_squash,insecure,rw

If /etc/exports has a line like:

NFS is being exported and you and you have ssh access to the machine.From your attacker machine while logged as root user run:

Now from inside a SSH session on the victim machine (in this example 192.168.42.32):

Good to know (either Windows and/or Linux)

Arch cross compile exploit (and diff glibc version)

IP restriction at application level, bypass

Try to send a request modifying the HTTP header by adding:

Windows - check OS information

Windows - check architecture

Powershell running as 32 or 64 bits

Nikto cheat sheet pdf

Linux LFI - intesresting files to look after

Simple Buffer Overflow (32 bits, NO ASLR and NO DEP)

Summarized steps

  • 0 - Crash the application
  • 1 - Fuzzing (find aprox number of bytes where the crash took place)
  • 2 - Find offset
  • 3 - EIP control
  • 4 - Check for enough space on buffer
  • 5 - Badchars counting
  • 6 - Find return address (JMP ESP)
  • 7 - Create payload

Fuzzing: example with vulnserver + spike on TRUN command

Now, start wireshark filtering on the target IP/PORT below and run the trun.spk:

Once a crash takes place, go to wireshark to locate the crash.

Badchars

From the block below, the next ones were not included (most common badchars):

So…actual list of badchars:

Usefull tools (on Kali Linux)

create_pattern

pattern_offset

nasm_shell

Nikto Cheat Sheet 2018

msfvenom

Nikto Cheat Sheet Template

Shellcode POC: calc.exe

Comments are closed.