designates my notes. / designates important.
A good general introduction to what you can do with Kali, for the most part out of the box, but I’d have to say “Mastering” and “Advanced” is a bit of a stretch. Given the breadth of topics covered, each of which can be explored in books of their own, the information is, although sometimes dated, top-notch.
For example, something like nmap is covered only in the most basic how to use sense. Although intrusion detection systems are mentioned, and the noisiness of scans also mentioned, there is nothing that would be considered advanced. There is a small library of books written on nmap alone while it is only one of dozens of programs highlighted in this one.
Sites that provide lookups of DNS, route, and server information, especially, DNSstuff (www.dnsstuff.com), ServerSniff (www.serversniff.net), Netcraft (www.netcraft.com), and myIPneighbors.com
Shodan (www.shodanHQ.com), sometimes referred to as the “hacker’s Google”; Shodan lists Internet-accessible devices and allows the tester to search for devices with known vulnerabilities
Password dumpsites (pastebin, search using site:pastebin.com “targetURL”)
it is possible for the DHCP to interact with the target system, which could be logged and send alarms to the target’s administrators.
Some commercial and open source tools (for example, the Metasploit Framework) tag their packets with an identifying sequence. Although this can be useful in post-test analysis of a system’s event logs (where events initiated by a particular testing tool can be directly compared to a system’s event logs to determine how the network detected and responded to the attack), it can also trigger certain intrusion detection systems. Test your tools against a lab system to determine the packets that are tagged, and either change the tag, or use the tool with caution.
search the packet capture (pcap) files for the any keywords that can be attributed to the testing tool (name of the tool, vendor, license number, and so on).
Identify the goal of the scan before testing and send the minimum number of packets needed to determine the objective. For example, if you wish to confirm the presence of a web host, you first need to determine if port 80 , the default port for web-based services, is open.
Avoid scans that may connect with the target system and leak data. Do not ping the target or use synchronize (SYN) and nonconventional packet scans, such as acknowledge (ACK), finished (FIN), and reset (RST) packets.
Randomize or spoof packet settings, such as the source IP and port address, and the MAC address.
Adjust the timing to slow the arrival of packets at the target site.
Change the packet size by fragmenting packets or appending random data to confuse packet inspection devices.
SHODAN - Web-based search engine that identifies devices connected to the Internet, including those with default passwords, known misconfigurations, and vulnerabilities
change ttl to confuse OS detection
online sites that collect, analyze, and share information about vulnerabilities are as follows:
The National Vulnerability Database that consolidates all public vulnerability data released by the US Government available at http://web.nvd.nist.gov/view/vuln/search
Secunia available at http://secunia.com/community/
Open Source Vulnerability Database Project (OSVDP) available at http://www.osvdb.org/search/advsearch
Packetstorm security available at http://packetstormsecurity.com/
SecurityFocus available at http://www.securityfocus.com/ vulnerabilities
Inj3ct0r available at http://1337day.com/
The Exploit Database maintained by Offensive Security available at http://www.db-exploit.com
The exploit database is also copied locally to Kali and it can be found in the /usr/ share/exploitdb directory. Before using it, make sure that it has been updated using the following command:
cd /usr/share/exploitdb
tar -xvjf archive.tar.bz2
rm archive.tar.bz2
To search the local copy of exploitdb, open a terminal window and enter searchsploit and the desired search term(s) in the command prompt. This will invoke a script that searches a database file (.csv) that contains a list of all exploits. The search will return a description of known vulnerabilities as well as the path to a relevant exploit. The exploit can be extracted, compiled, and run against specific vulnerabilities.
if the compromised system is Unix, then the attacker will also target the following:
The system and configuration files (usually in the /etc directory, but depending on the implementation, they may be in /usr/local/etc or other locations)
The password files (/etc/password and /etc/shadow)
The configuration files and public/private keys in the .ssh directory
The public and private key rings that may be contained in the .gnupg directory
The e-mail and data files
In a Windows system, the attacker will target the following:
The system memory, which can be used to extract passwords, encryption keys, and so on
The system registry files
The Security Accounts Manager (SAM) database that contains hashed versions of the password, or alternative versions of the SAM database which may be found in %SYSTEMROOT%\repair\SAM and %SYSTEMROOT%\System32\ config\RegBack\SAM
Any other password or seed files used for encryption
The e-mail and data files
Don’t forget to review folders that contain temporary items, such as
attachments. For example, UserProfile\AppData\Local
Microsoft\Windows\Temporary Internet Files\ may contain files, images, and
cookies that may be of interest.
The system memory can be downloaded as a single image file from several sources as follows:
By uploading a tool to the compromised system and then directly copying the memory (the tools include Belkasoft RAM capturer, MandiantMemoryze, and MonsolsDumpIt).
By copying Windows hibernation file, hiberfil.sys and then using Volatility to decrypt and analyze the file. Volatility, found on Kali in the Forensics menu, is a framework that was written to analyze memory dumps from the system RAM and other files containing system memory. It relies on plugins written in Python to analyze the memory and extract data, such as encryption keys, passwords, registry information, processes, and connectivity information.
By copying a virtual machine and converting the VMEM file to a memory file.
If you upload a program designed to capture memory onto a compromised system, it is possible that this particular application will be identified as malicious software by an antivirus software. Most antivirus software applications recognize the hash signature and behavior of memory acquisition software, and act to protect the sensitive contents of the physical memory by raising an alarm if it is at risk of disclosure. The acquisition software will be quarantined, and the target will receive a warning alerting them of the attack.
To avoid this, use Metasploit Framework to run the executable completely in the target’s memory using the following command:
meterpreter> execute -H -m -d calc.exe -f <memory executable + parameters>
The previous command executes calc.exe as a dummy executable but uploads the memory acquisition executable to run in its process space instead.
The executable doesn’t show up in process lists, such as Task Manager, and detection using data forensic techniques is much harder because it’s not written to disk. Furthermore, it will avoid the system’s antivirus software, which generally does not scan the memory space in search of malware.
Using the sample image for a system infected with Zeus malware (https://code. google.com/p/volatility/wiki/SampleMemoryImages), we’ll use Volatility Framework to extract the encrypted LanMan password hashes.
using volitility on windows
dsniff is designed to extract passwords from live transmissions or a pcap file saved from a Wireshark or tshark session
Dump the SAM and SYSKEY files using meterpreter or applications such as hobocopy, fgdump, and pwdump (these can be uploaded on the target using meterpreter).
Inject malicious code directly into a service running at the SYSTEM level using a tool such as process injector (www.tarasco.org/security/Process_Injector/).
When some applications load, they read dynamic link library (DLL) files in a particular order. It is possible to create a fake DLL with the same name as a legitimate DLL, place it in a specific directory location, and have the application load and execute it, resulting in elevated privileges for the attacker. Several applications are known to be vulnerable to such DLL hijacking (www.exploit-db.com/dll-hijacking-vulnerable-applications/).
Execute the getsystem script, which will automatically escalate administrator privileges to the SYSTEM level, from the meterpreter prompt.
Windows 7 and 2008 don’t allow remote access to administrative shares, such as ADMIN$, C$, and so on, from untrusted systems. These shares may be required for meterpreter scripts, such as incognito, or to support attacks over SMB. To address this issue, add HKEY_LOCAL_ MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ Policies\System to the registry, and add a new DWORD (32-bit) key named LocalAccountTokenFilterPolicy and set the value to 1.
The Credential harvesting attack is an excellent tool for assessing the security of a corporate network. To be effective, the organization must first train all employees on how to recognize and respond to a phishing attack. Approximately two weeks later, send a corporate-wide e-mail that contains some obvious mistakes (incorrect name of the corporate CEO or an address block that contains the wrong address) and a link to a program that harvests credentials. Calculate the percentage of recipients who responded with their credentials, and then tailor the training program to reduce this percentage.
Are people so gullible that “obvious mistakes” must, intentionally, be included?
root@kali:~# iwconfig wlan0 txpower 30
root@kali:~# airmon-ng start wlan0
root@kali:~# airmon-ng check kill
root@kali:~# airodump-ng mon0
root@kali:~# aireplay-ng -9 mon0 //-9 indicates an injection test
root@kali:~# kismet
If you reconfirm with ifconfig, you will see that there is now a monitoring
or mon0 address in use. Now, use airodump to confirm the available wireless
networks, as given in the following command: root@kali:~# airodump-ng mon0
root@kali:~# airodump-ng -c 6 mon0
Executing the command removes the output
from the multiple wireless sources, and allows the attacker to focus on the
target ESSID
root@kali:~# ifconfig wlan0 down
root@kali:~# ifconfig wlan0 | grep HW
root@kali:~# ifconfig wlan0 hw ether 38:33:15:xx:xx:xx
root@kali:~# ifconfig wlan0 up
root@kali:~# macchanger wlan0 -e
root@kali:~# macchanger wlan0 -r
Fern GUI for aircrack-ng
wifite text base aircrack-ng frontend
To implement this attack, first convert the WPA handshake capture file,
psk-01.cap to a hashcat file using the following command: root@kali:~# aircrack-ng psk-01.cap -J <output file>
When the conversion is completed, run the hashcat against the new capture
file (choose the version of hashcat that matches your CPU architecture and
your graphics card) using the following command: root@kali:~# cudaHashcat-plus32.bin -m 2500 <filename>.hccap <wordlist>
Reaver WPA attack
Denial of service
websploit
Next can use a more complete scanner, like, vega
Another scanner worth using is the Web Application Attack and Audit Framework (w3af), a Python-based open-source web application security scanner. It provides preconfigured vulnerability scans in support of standards such as OWASP. The breadth of the scanner’s options comes at a price—it takes significantly longer than other scanners to review a target, and it is prone to failure over long testing periods.
Kali comes with hydra, a command-line tool, and hydra-gtk, which has a GUI interface. Both tools allow a tester to brute force or iterate possible usernames and passwords against a specified service. Multiple communication protocols are supported, including FTP, FTPS, HTTP, HTTPS, ICQ, IRC, LDAP, MySQL, Oracle, POP3, pcAnywhere, SNMP, SSH, VNC, and others.
One of the most useful tools for assessing SQL injection vulnerabilities is sqlmap, a Python tool that automates the reconnaissance and exploitation of Firebird, Microsoft SQL, MySQL, Oracle, PostgreSQL, Sybase, and SAP MaxDB databases.
RDP port 3389
The nmap tool now includes specialized scripts that provide additional
details about RDP, including the configuration of the encryption. If time
permits, and if stealth is not an issue, these should be used during the
initial scanning stage. The command line to invoke the script that enumerates
supported encryption protocols is as follows: root@kali:~# nmap – p 3389 –-script rdp-enum-encryption <IP>
The nmap tool now includes specialized scripts that provide additional
details about RDP, including the configuration of the encryption. If time
permits, and if stealth is not an issue, these should be used during the
initial scanning stage. The command line to invoke the script that enumerates
supported encryption protocols is as follows: root@kali:~# nmap – p 3389 –-script rdp-enum-encryption <IP>
target-specific dictionaries can also be constructed to be target specific using tools such as CeWL and crunch
Kali provides several tools to brute-force access, including hydra, medusa, ncrack, and patator. Through testing, we have found ncrack to be the most reliable
root@kali:~# ncrack -vv -U user.lst -P password.list <Taget IP>:<Target Port>
root@kali:~# hydra -s 22 -v -V -L <file path/name> -P <file path/name> -t 8 <Target IP><protocol>
-
s designates the port to be used. Although it does not need to be entered when
the default port is intended to be used, it is used to remove ambiguities and
because it speeds up testing, in this case.-v
and -V
select the maximum verbosity of reports.-L
selects the login, or username file.-P
selects the password file.-t
selects the number of parallel tasks or connections. The greater the number,
the faster the testing will occur. However, if the number is too high, errors
may be introduced and correct passwords will be missed.The database specified in the Mutillidae configuration file is incorrect, and
you may receive multiple errors for operations that require database access.
To fix these, log in to Metasploitable2 and edit the
/var/www/mutillidae/config.inc
file; change the dbname field from metasploit to
owasp10.
Hackxor: This is a web application hacking game that forces players to progress through a story to solve challenges related to various vulnerabilities (http://hackxor.sourceforge.net/cgi-bin/index.pl).
Foundstone: This has released a series of vulnerable web applications, including a bank, bookstore, casino, shipping, and a travel site (www.mcafee.com/us/downloads/free-tools/index.aspx).
OWASP Broken Web Applications Project: This is a collection of vulnerable web applications (http://code.google.com/p/owaspbwa/).
WebGoat: This is an insecure J2EE web application that attempts to provide a realistic testing environment. It is maintained by OWASP (https://www.owasp.org/index.php/Category:OWASP_WebGoat_Project).
Web Security Dojo: This training application released by Maven Security (https://www.mavensecurity.com/web_security_dojo/), contains several target images, including Damn Vulnerable Web App, Google’s Gruyere, Hackme’s Casino, OWASP’s Insecure Web App and WebGoat, w3af’s test website, and several vulnerability-specific targets. It also contains a toolset to support exploitation.