# 80,443 - Metodologia Pentesting Web {{#include ../../banners/hacktricks-training.md}} ## Informazioni di base Il servizio web è il servizio più **comune e diffuso** e esistono molti **diversi tipi di vulnerabilità**. **Porta predefinita:** 80 (HTTP), 443(HTTPS) ```bash PORT STATE SERVICE 80/tcp open http 443/tcp open ssl/https ``` ```bash nc -v domain.com 80 # GET / HTTP/1.0 openssl s_client -connect domain.com:443 # GET / HTTP/1.0 ``` ### Linee guida Web API {{#ref}} web-api-pentesting.md {{#endref}} ## Riassunto della metodologia > In questa metodologia supponiamo che tu stia per attaccare un dominio (o sottodominio) e solo quello. Quindi, dovresti applicare questa metodologia a ogni dominio, sottodominio o IP scoperto con web server non determinato all'interno dell'ambito. - [ ] Inizia **identificando** le **tecnologie** usate dal web server. Cerca **trucchi** da tenere a mente durante il resto del test se riesci a identificare con successo la tech. - [ ] Qualsiasi **vulnerabilità nota** della versione della tecnologia? - [ ] Stai usando qualche **tech ben nota**? Qualche **trucco utile** per estrarre più informazioni? - [ ] Qualche **scanner specializzato** da eseguire (come wpscan)? - [ ] Avvia **scanner a scopo generale**. Non sai mai se troveranno qualcosa o qualche informazione interessante. - [ ] Inizia con i **controlli iniziali**: **robots**, **sitemap**, **errore 404** e **SSL/TLS scan** (se HTTPS). - [ ] Inizia a **spiderare** la pagina web: è il momento di **trovare** tutti i possibili **file, cartelle** e **parametri in uso.** Controlla anche la presenza di **risultati speciali**. - [ ] _Nota che ogni volta che viene scoperta una nuova directory durante brute-forcing o spidering, dovrebbe essere spiderata._ - [ ] **Directory Brute-Forcing**: prova a brute-forzare tutte le cartelle scoperte cercando nuovi **file** e **directory**. - [ ] _Nota che ogni volta che viene scoperta una nuova directory durante brute-forcing o spidering, dovrebbe essere Brute-Forced._ - [ ] **Controllo backup**: verifica se puoi trovare **backup** di **file scoperti** aggiungendo estensioni di backup comuni. - [ ] **Brute-Force parametri**: prova a **trovare parametri nascosti**. - [ ] Una volta che hai **identificato** tutti i possibili **endpoint** che accettano **input utente**, verifica ogni tipo di **vulnerabilità** relativa a essi. - [ ] [Follow this checklist](../../pentesting-web/web-vulnerabilities-methodology.md) ## Versione del Server (Vulnerabile?) ### Identificare Controlla se esistono **vulnerabilità note** per la **versione** del server in esecuzione.\ Le **HTTP headers e i cookies della response** potrebbero essere molto utili per **identificare** le **tecnologie** e/o la **versione** in uso. **Nmap scan** può identificare la versione del server, ma possono essere utili anche gli strumenti [**whatweb**](https://github.com/urbanadventurer/WhatWeb)**,** [**webtech** ](https://github.com/ShielderSec/webtech) o [**https://builtwith.com/**](https://builtwith.com)**:** ```bash whatweb -a 1 #Stealthy whatweb -a 3 #Aggresive webtech -u webanalyze -host https://google.com -crawl 2 ``` Search **for** [**vulnerabilities of the web application** **version**](../../generic-hacking/search-exploits.md) ### **Verifica la presenza di WAF** - [**https://github.com/EnableSecurity/wafw00f**](https://github.com/EnableSecurity/wafw00f) - [**https://github.com/Ekultek/WhatWaf.git**](https://github.com/Ekultek/WhatWaf.git) - [**https://nmap.org/nsedoc/scripts/http-waf-detect.html**](https://nmap.org/nsedoc/scripts/http-waf-detect.html) ### Web tech tricks Alcuni **trucchi** per **finding vulnerabilities** in diverse ben note **technologies** in uso: - [**AEM - Adobe Experience Cloud**](aem-adobe-experience-cloud.md) - [**Apache**](apache.md) - [**Artifactory**](artifactory-hacking-guide.md) - [**Buckets**](buckets/index.html) - [**CGI**](cgi.md) - [**Drupal**](drupal/index.html) - [**Flask**](flask.md) - [**Git**](git.md) - [**Golang**](golang.md) - [**GraphQL**](graphql.md) - [**H2 - Java SQL database**](h2-java-sql-database.md) - [**ISPConfig**](ispconfig.md) - [**IIS tricks**](iis-internet-information-services.md) - [**Microsoft SharePoint**](microsoft-sharepoint.md) - [**JBOSS**](jboss.md) - [**Jenkins**](<[https:/github.com/carlospolop/hacktricks/blob/master/network-services-pentesting/pentesting-web/broken-reference/README.md](https:/github.com/HackTricks-wiki/hacktricks-cloud/tree/master/pentesting-ci-cd/jenkins-security)/>) - [**Jira**](jira.md) - [**Joomla**](joomla.md) - [**JSP**](jsp.md) - [**Laravel**](laravel.md) - [**Moodle**](moodle.md) - [**Nginx**](nginx.md) - [**PHP (php has a lot of interesting tricks that could be exploited)**](php-tricks-esp/index.html) - [**Python**](python.md) - [**Spring Actuators**](spring-actuators.md) - [**Symphony**](symphony.md) - [**Tomcat**](tomcat/index.html) - [**VMWare**](vmware-esx-vcenter....md) - [**Web API Pentesting**](web-api-pentesting.md) - [**WebDav**](put-method-webdav.md) - [**Werkzeug**](werkzeug.md) - [**Wordpress**](wordpress.md) - [**Electron Desktop (XSS to RCE)**](electron-desktop-apps/index.html) _Tieni in considerazione che lo **stesso dominio** può utilizzare **diverse tecnologie** su diverse **porte**, **cartelle** e **sottodomini**._\ Se la web application sta usando una delle **tech/platform elencate prima** o **qualsiasi altra**, non dimenticare di **cercare su Internet** nuovi trucchi (e fammi sapere!). ### Source Code Review Se il **source code** dell'applicazione è disponibile su **github**, oltre a eseguire da **te un White box test** dell'applicazione ci sono **alcune informazioni** che potrebbero essere **utili** per l'attuale **Black-Box testing**: - Esiste un **Change-log o Readme o Version** file o qualcosa con **informazioni di versione** accessibile via web? - Come e dove vengono salvate le **credentials**? Esiste qualche (accessibile?) **file** con credentials (usernames o passwords)? - Le passwords sono in **plain text**, **encrypted** o quale **hashing algorithm** viene usato? - Sta usando una **master key** per cifrare qualcosa? Quale **algoritmo** viene usato? - Puoi accedere a uno di questi file sfruttando qualche **vulnerability**? - Ci sono informazioni interessanti su **github** (issues risolte e non risolte)? O nella cronologia dei commit (forse qualche password introdotta in un vecchio commit)? {{#ref}} code-review-tools.md {{#endref}} ### Automatic scanners #### General purpose automatic scanners ```bash nikto -h whatweb -a 4 wapiti -u W3af zaproxy #You can use an API nuclei -ut && nuclei -target # https://github.com/ignis-sec/puff (client side vulns fuzzer) node puff.js -w ./wordlist-examples/xss.txt -u "http://www.xssgame.com/f/m4KKGHi2rVUN/?query=FUZZ" ``` #### Scanner per CMS Se viene usato un CMS, non dimenticare di **eseguire uno scanner**, potrebbe essere trovato qualcosa di interessante: [**Clusterd**](https://github.com/hatRiot/clusterd)**:** [**JBoss**](jboss.md)**, ColdFusion, WebLogic,** [**Tomcat**](tomcat/index.html)**, Railo, Axis2, Glassfish**\ [**CMSScan**](https://github.com/ajinabraham/CMSScan): [**WordPress**](wordpress.md), [**Drupal**](drupal/index.html), **Joomla**, **vBulletin** siti web per vulnerabilità di sicurezza. (GUI)\ [**VulnX**](https://github.com/anouarbensaad/vulnx)**:** [**Joomla**](joomla.md)**,** [**Wordpress**](wordpress.md)**,** [**Drupal**](drupal/index.html)**, PrestaShop, Opencart**\ **CMSMap**: [**(W)ordpress**](wordpress.md)**,** [**(J)oomla**](joomla.md)**,** [**(D)rupal**](drupal/index.html) **o** [**(M)oodle**](moodle.md)\ [**droopscan**](https://github.com/droope/droopescan)**:** [**Drupal**](drupal/index.html)**,** [**Joomla**](joomla.md)**,** [**Moodle**](moodle.md)**, Silverstripe,** [**Wordpress**](wordpress.md) ```bash cmsmap [-f W] -F -d wpscan --force update -e --url joomscan --ec -u joomlavs.rb #https://github.com/rastating/joomlavs ``` > A questo punto dovresti già avere alcune informazioni sul web server usato dal client (se sono stati forniti dati) e alcuni trucchi da tenere a mente durante il test. Se sei fortunato potresti aver anche trovato un CMS ed eseguito qualche scanner. ## Step-by-step Web Application Discovery > From this point we are going to start interacting with the web application. ### Initial checks **Default pages with interesting info:** - /robots.txt - /sitemap.xml - /crossdomain.xml - /clientaccesspolicy.xml - /.well-known/ - Check also comments in the main and secondary pages. **Forcing errors** I web server possono **comportarsi in modo inaspettato** quando vengono inviati dati strani. Questo può aprire **vulnerabilità** o causare **esposizione di informazioni sensibili**. - Accedi a **pagine fake** come /whatever_fake.php (.aspx,.html,.etc) - **Aggiungi "\[]", "]]", and "\[\["** nei **valori dei cookie** e nei **valori dei parametri** per creare errori - Genera un errore fornendo come input **`/~randomthing/%s`** alla **fine** della **URL** - Prova **diversi HTTP Verbs** come PATCH, DEBUG o sbagliati come FAKE #### **Check if you can upload files (**[**PUT verb, WebDav**](put-method-webdav.md)**)** Se scopri che **WebDav** è **abilitato** ma non hai permessi sufficienti per **caricare file** nella cartella root, prova a: - **Brute Force** credentials - **Caricare file** via WebDav nelle **altre** **cartelle trovate** all'interno della pagina web. Potresti avere i permessi per caricare file in altre directory. ### **SSL/TLS vulnerabilites** - Se l'applicazione **non forza l'uso di HTTPS** in nessuna parte, allora è **vulnerabile a MitM** - Se l'applicazione **invia dati sensibili (password) usando HTTP**. Allora è una vulnerabilità critica. Usa [**testssl.sh**](https://github.com/drwetter/testssl.sh) per verificare la presenza di **vulnerabilità** (Nei programmi di Bug Bounty probabilmente questo tipo di vulnerabilità non verrà accettato) e usa [**a2sv** ](https://github.com/hahwul/a2sv) per ricontrollare le vulnerabilità: ```bash ./testssl.sh [--htmlfile] 10.10.10.10:443 #Use the --htmlfile to save the output inside an htmlfile also # You can also use other tools, by testssl.sh at this momment is the best one (I think) sslscan sslyze --regular ``` Informazioni sulle vulnerabilità SSL/TLS: - [https://www.gracefulsecurity.com/tls-ssl-vulnerabilities/](https://www.gracefulsecurity.com/tls-ssl-vulnerabilities/) - [https://www.acunetix.com/blog/articles/tls-vulnerabilities-attacks-final-part/](https://www.acunetix.com/blog/articles/tls-vulnerabilities-attacks-final-part/) ### Spidering Avvia una sorta di **spider** sul web. L'obiettivo dello spider è **trovare quanti più percorsi possibile** dall'applicazione testata. Perciò, web crawling e fonti esterne dovrebbero essere usate per trovare il maggior numero possibile di percorsi validi. - [**gospider**](https://github.com/jaeles-project/gospider) (go): HTML spider, LinkFinder nei file JS e in fonti esterne (Archive.org, CommonCrawl.org, VirusTotal.com, AlienVault.com). - [**hakrawler**](https://github.com/hakluke/hakrawler) (go): HTML spider, con LinkFinder per file JS e Archive.org come fonte esterna. - [**dirhunt**](https://github.com/Nekmo/dirhunt) (python): HTML spider, indica anche i "juicy files". - [**evine** ](https://github.com/saeeddhqan/evine)(go): Interactive CLI HTML spider. Cerca anche in Archive.org. - [**meg**](https://github.com/tomnomnom/meg) (go): Questo strumento non è uno spider ma può essere utile. Puoi indicare un file con hosts e un file con path e meg scaricherà ogni path su ogni host e salverà la risposta. - [**urlgrab**](https://github.com/IAmStoxe/urlgrab) (go): HTML spider con capacità di rendering JS. Tuttavia, sembra non essere mantenuto, la versione precompilata è vecchia e il codice attuale non compila. - [**gau**](https://github.com/lc/gau) (go): HTML spider che usa provider esterni (wayback, otx, commoncrawl). - [**ParamSpider**](https://github.com/devanshbatham/ParamSpider): Questo script troverà URL con parametri e li elencherà. - [**galer**](https://github.com/dwisiswant0/galer) (go): HTML spider con capacità di rendering JS. - [**LinkFinder**](https://github.com/GerbenJavado/LinkFinder) (python): HTML spider, con capacità di JS beautify in grado di cercare nuovi percorsi nei file JS. Potrebbe valere la pena dare un'occhiata anche a [JSScanner](https://github.com/dark-warlord14/JSScanner), che è un wrapper di LinkFinder. - [**goLinkFinder**](https://github.com/0xsha/GoLinkFinder) (go): Per estrarre endpoint sia dal sorgente HTML che dai file javascript incorporati. Utile per bug hunters, red teamers, infosec ninjas. - [**JSParser**](https://github.com/nahamsec/JSParser) (python2.7): Uno script python 2.7 che usa Tornado e JSBeautifier per parsare URL relative dai file JavaScript. Utile per scoprire facilmente richieste AJAX. Sembra non essere mantenuto. - [**relative-url-extractor**](https://github.com/jobertabma/relative-url-extractor) (ruby): Dato un file (HTML) estrarrà URL da esso usando espressioni regolari per trovare ed estrarre URL relative da file minificati. - [**JSFScan**](https://github.com/KathanP19/JSFScan.sh) (bash, diversi tools): Raccoglie informazioni interessanti dai file JS usando diversi strumenti. - [**subjs**](https://github.com/lc/subjs) (go): Trova file JS. - [**page-fetch**](https://github.com/detectify/page-fetch) (go): Carica una pagina in un browser headless e stampa tutti gli url caricati per caricare la pagina. - [**Feroxbuster**](https://github.com/epi052/feroxbuster) (rust): Strumento di content discovery che combina varie opzioni dei tool precedenti. - [**Javascript Parsing**](https://github.com/xnl-h4ck3r/burp-extensions): Una estensione per Burp per trovare path e param nei file JS. - [**Sourcemapper**](https://github.com/denandz/sourcemapper): Uno strumento che, dato l'URL .js.map, restituisce il codice JS beatificato. - [**xnLinkFinder**](https://github.com/xnl-h4ck3r/xnLinkFinder): Strumento per scoprire endpoint per un target dato. - [**waymore**](https://github.com/xnl-h4ck3r/waymore)**:** Scopri link dalla wayback machine (scaricando anche le risposte nella wayback e cercando altri link). - [**HTTPLoot**](https://github.com/redhuntlabs/HTTPLoot) (go): Crawl (anche compilando form) e trova anche info sensibili usando regex specifiche. - [**SpiderSuite**](https://github.com/3nock/SpiderSuite): Spider Suite è un advance multi-feature GUI web security Crawler/Spider progettato per professionisti della cyber security. - [**jsluice**](https://github.com/BishopFox/jsluice) (go): È un package Go e uno [strumento da riga di comando](https://github.com/BishopFox/jsluice/blob/main/cmd/jsluice) per estrarre URLs, path, secrets e altri dati interessanti dal codice sorgente JavaScript. - [**ParaForge**](https://github.com/Anof-cyber/ParaForge): ParaForge è una semplice **Burp Suite extension** per **estrarre i parametri e gli endpoint** dalle richieste per creare wordlist personalizzate per fuzzing e enumerazione. - [**katana**](https://github.com/projectdiscovery/katana) (go): Ottimo strumento per questo. - [**Crawley**](https://github.com/s0rg/crawley) (go): Stampa ogni link che riesce a trovare. ### Brute Force directories and files Start **brute-forcing** from the root folder and be sure to brute-force **all** the **directories found** using **this method** and all the directories **discovered** by the **Spidering** (you can do this brute-forcing **recursively** and appending at the beginning of the used wordlist the names of the found directories).\ Tools: - **Dirb** / **Dirbuster** - Included in Kali, **old** (and **slow**) but functional. Allow auto-signed certificates and recursive search. Too slow compared with th other options. - [**Dirsearch**](https://github.com/maurosoria/dirsearch) (python)**: It doesn't allow auto-signed certificates but** allows recursive search. - [**Gobuster**](https://github.com/OJ/gobuster) (go): It allows auto-signed certificates, it **doesn't** have **recursive** search. - [**Feroxbuster**](https://github.com/epi052/feroxbuster) **- Fast, supports recursive search.** - [**wfuzz**](https://github.com/xmendez/wfuzz) `wfuzz -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt https://domain.com/api/FUZZ` - [**ffuf** ](https://github.com/ffuf/ffuf)- Fast: `ffuf -c -w /usr/share/wordlists/dirb/big.txt -u http://10.10.10.10/FUZZ` - [**uro**](https://github.com/s0md3v/uro) (python): Questo non è uno spider ma uno strumento che, data la lista di URL trovati, elimina gli URL "duplicati". - [**Scavenger**](https://github.com/0xDexter0us/Scavenger): Burp Extension per creare una lista di directory dalla history di Burp di diverse pagine. - [**TrashCompactor**](https://github.com/michael1026/trashcompactor): Rimuove URL con funzionalità duplicate (basato su import JS). - [**Chamaleon**](https://github.com/iustin24/chameleon): Usa wapalyzer per rilevare le tecnologie usate e selezionare le wordlist da usare. **Recommended dictionaries:** - [https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/bf_directories.txt](https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/bf_directories.txt) - [**Dirsearch** included dictionary](https://github.com/maurosoria/dirsearch/blob/master/db/dicc.txt) - [http://gist.github.com/jhaddix/b80ea67d85c13206125806f0828f4d10](http://gist.github.com/jhaddix/b80ea67d85c13206125806f0828f4d10) - [Assetnote wordlists](https://wordlists.assetnote.io) - [https://github.com/danielmiessler/SecLists/tree/master/Discovery/Web-Content](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/random-robbie/bruteforce-lists](https://github.com/random-robbie/bruteforce-lists) - [https://github.com/google/fuzzing/tree/master/dictionaries](https://github.com/google/fuzzing/tree/master/dictionaries) - [https://github.com/six2dez/OneListForAll](https://github.com/six2dez/OneListForAll) - [https://github.com/random-robbie/bruteforce-lists](https://github.com/random-robbie/bruteforce-lists) - [https://github.com/ayoubfathi/leaky-paths](https://github.com/ayoubfathi/leaky-paths) - _/usr/share/wordlists/dirb/common.txt_ - _/usr/share/wordlists/dirb/big.txt_ - _/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt_ _Note that anytime a new directory is discovered during brute-forcing or spidering, it should be Brute-Forced._ ### What to check on each file found - [**Broken link checker**](https://github.com/stevenvachon/broken-link-checker): Trova link rotti negli HTML che potrebbero essere suscettibili di takeover. - **File Backups**: Una volta trovati tutti i file, cerca backup di tutti i file eseguibili ("_.php_", "_.aspx_"...). Varianti comuni per il naming di un backup sono: _file.ext\~, #file.ext#, \~file.ext, file.ext.bak, file.ext.tmp, file.ext.old, file.bak, file.tmp and file.old._ Puoi anche usare lo strumento [**bfac**](https://github.com/mazen160/bfac) **or** [**backup-gen**](https://github.com/Nishantbhagat57/backup-gen)**.** - **Discover new parameters**: Puoi usare strumenti come [**Arjun**](https://github.com/s0md3v/Arjun)**,** [**parameth**](https://github.com/maK-/parameth)**,** [**x8**](https://github.com/sh1yo/x8) **and** [**Param Miner**](https://github.com/PortSwigger/param-miner) **per scoprire parametri nascosti. Se possibile, prova a cercare** parametri nascosti in ogni file web eseguibile. - _Arjun all default wordlists:_ [https://github.com/s0md3v/Arjun/tree/master/arjun/db](https://github.com/s0md3v/Arjun/tree/master/arjun/db) - _Param-miner “params” :_ [https://github.com/PortSwigger/param-miner/blob/master/resources/params](https://github.com/PortSwigger/param-miner/blob/master/resources/params) - _Assetnote “parameters_top_1m”:_ [https://wordlists.assetnote.io/](https://wordlists.assetnote.io) - _nullenc0de “params.txt”:_ [https://gist.github.com/nullenc0de/9cb36260207924f8e1787279a05eb773](https://gist.github.com/nullenc0de/9cb36260207924f8e1787279a05eb773) - **Comments:** Controlla i commenti di tutti i file, potresti trovare **credentials** o **funzionalità nascoste**. - Se stai giocando un **CTF**, un trucco "comune" è **nascondere** **informazioni** nei commenti alla **destra** della **pagina** (usando **centinaia** di **spazi** così non vedi i dati se apri il sorgente con il browser). Un'altra possibilità è usare **diverse nuove linee** e **nascondere informazioni** in un commento in fondo alla pagina web. - **API keys**: Se **trovi una API key** esiste una guida che indica come usare API keys di diverse piattaforme: [**keyhacks**](https://github.com/streaak/keyhacks)**,** [**zile**](https://github.com/xyele/zile.git)**,** [**truffleHog**](https://github.com/trufflesecurity/truffleHog)**,** [**SecretFinder**](https://github.com/m4ll0k/SecretFinder)**,** [**RegHex**]()**,** [**DumpsterDive**](https://github.com/securing/DumpsterDiver)**,** [**EarlyBird**](https://github.com/americanexpress/earlybird) - Google API keys: Se trovi una API key che inizia come **AIza**SyA-qLheq6xjDiEIRisP_ujUseYLQCHUjik puoi usare il progetto [**gmapapiscanner**](https://github.com/ozguralp/gmapsapiscanner) per verificare quali APIs la key può accedere. - **S3 Buckets**: Mentre esegui lo spidering verifica se qualche **subdomain** o qualche **link** è collegato a un **S3 bucket**. In tal caso, [**check** the **permissions** of the bucket](buckets/index.html). ### Special findings **While** performing the **spidering** and **brute-forcing** you could find **interesting** **things** that you have to **notice**. **Interesting files** - Cerca **link** ad altri file all'interno dei file **CSS**. - [If you find a _**.git**_ file some information can be extracted](git.md) - Se trovi un _**.env**_ informazioni come api keys, password db e altre informazioni possono essere trovate. - Se trovi **API endpoints** dovresti anche testarle ([web-api-pentesting.md]). Queste non sono file, ma probabilmente "sembra" che lo siano. - **JS files**: Nella sezione spidering sono stati menzionati diversi tool che possono estrarre path dai file JS. Inoltre, sarebbe interessante **monitorare ogni file JS trovato**, poiché in alcune occasioni una modifica può indicare che è stata introdotta una potenziale vulnerabilità nel codice. Puoi usare ad esempio [**JSMon**](https://github.com/robre/jsmon)**.** - Dovresti anche verificare i file JS scoperti con [**RetireJS**](https://github.com/retirejs/retire.js/) o [**JSHole**](https://github.com/callforpapers-source/jshole) per vedere se sono vulnerabili. - **Javascript Deobfuscator and Unpacker:** [https://lelinhtinh.github.io/de4js/](https://lelinhtinh.github.io/de4js/), [https://www.dcode.fr/javascript-unobfuscator](https://www.dcode.fr/javascript-unobfuscator) - **Javascript Beautifier:** [http://jsbeautifier.org/](https://beautifier.io), [http://jsnice.org/](http://jsnice.org) - **JsFuck deobfuscation** (javascript with chars:"\[]!+" [https://enkhee-osiris.github.io/Decoder-JSFuck/](https://enkhee-osiris.github.io/Decoder-JSFuck/)) - [**TrainFuck**](https://github.com/taco-c/trainfuck)**:** `+72.+29.+7..+3.-67.-12.+55.+24.+3.-6.-8.-67.-23.` - In molte occasioni, avrai bisogno di **comprendere le regular expressions** usate. Questo sarà utile: [https://regex101.com/](https://regex101.com) o [https://pythonium.net/regex](https://pythonium.net/regex) - Potresti anche **monitorare i file dove sono stati rilevati form**, poiché una modifica nei parametri o la comparsa di un nuovo form potrebbe indicare una nuova funzionalità potenzialmente vulnerabile. **403 Forbidden/Basic Authentication/401 Unauthorized (bypass)** {{#ref}} 403-and-401-bypasses.md {{#endref}} **502 Proxy Error** Se una pagina **risponde** con quel **codice**, probabilmente è un **proxy** mal configurato. **Se invii una richiesta HTTP come: `GET https://google.com HTTP/1.1`** (con l'header Host e altri header comuni), il **proxy** tenterà di **accedere** a _**google.com**_ **e avrai trovato una** SSRF. **NTLM Authentication - Info disclosure** Se il server che richiede l'autenticazione è **Windows** o trovi una login che chiede le tue **credentials** (e chiede il **domain** **name**), puoi provocare una **information disclosure**.\ **Invia** l'**header**: `“Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=”` e, a causa di come funziona l'**NTLM authentication**, il server risponderà con info interne (versione IIS, versione Windows...) nell'header "WWW-Authenticate".\ Puoi **automatizzare** questo usando il **nmap plugin** "_http-ntlm-info.nse_". **HTTP Redirect (CTF)** È possibile **mettere contenuto** all'interno di una **Redirection**. Questo contenuto **non sarà mostrato all'utente** (poiché il browser eseguirà la redirezione) ma qualcosa potrebbe essere **nascosto** lì. ### Web Vulnerabilities Checking Now that a comprehensive enumeration of the web application has been performed it's time to check for a lot of possible vulnerabilities. You can find the checklist here: {{#ref}} ../../pentesting-web/web-vulnerabilities-methodology.md {{#endref}} Find more info about web vulns in: - [https://six2dez.gitbook.io/pentest-book/others/web-checklist](https://six2dez.gitbook.io/pentest-book/others/web-checklist) - [https://kennel209.gitbooks.io/owasp-testing-guide-v4/content/en/web_application_security_testing/configuration_and_deployment_management_testing.html](https://kennel209.gitbooks.io/owasp-testing-guide-v4/content/en/web_application_security_testing/configuration_and_deployment_management_testing.html) - [https://owasp-skf.gitbook.io/asvs-write-ups/kbid-111-client-side-template-injection](https://owasp-skf.gitbook.io/asvs-write-ups/kbid-111-client-side-template-injection) ### Monitor Pages for changes Puoi usare strumenti come [https://github.com/dgtlmoon/changedetection.io](https://github.com/dgtlmoon/changedetection.io) per monitorare pagine e rilevare modifiche che potrebbero introdurre vulnerabilità. ### HackTricks Automatic Commands ``` Protocol_Name: Web #Protocol Abbreviation if there is one. Port_Number: 80,443 #Comma separated if there is more than one. Protocol_Description: Web #Protocol Abbreviation Spelled out Entry_1: Name: Notes Description: Notes for Web Note: | https://book.hacktricks.wiki/en/network-services-pentesting/pentesting-web/index.html Entry_2: Name: Quick Web Scan Description: Nikto and GoBuster Command: nikto -host {Web_Proto}://{IP}:{Web_Port} &&&& gobuster dir -w {Small_Dirlist} -u {Web_Proto}://{IP}:{Web_Port} && gobuster dir -w {Big_Dirlist} -u {Web_Proto}://{IP}:{Web_Port} Entry_3: Name: Nikto Description: Basic Site Info via Nikto Command: nikto -host {Web_Proto}://{IP}:{Web_Port} Entry_4: Name: WhatWeb Description: General purpose auto scanner Command: whatweb -a 4 {IP} Entry_5: Name: Directory Brute Force Non-Recursive Description: Non-Recursive Directory Brute Force Command: gobuster dir -w {Big_Dirlist} -u {Web_Proto}://{IP}:{Web_Port} Entry_6: Name: Directory Brute Force Recursive Description: Recursive Directory Brute Force Command: python3 {Tool_Dir}dirsearch/dirsearch.py -w {Small_Dirlist} -e php,exe,sh,py,html,pl -f -t 20 -u {Web_Proto}://{IP}:{Web_Port} -r 10 Entry_7: Name: Directory Brute Force CGI Description: Common Gateway Interface Brute Force Command: gobuster dir -u {Web_Proto}://{IP}:{Web_Port}/ -w /usr/share/seclists/Discovery/Web-Content/CGIs.txt -s 200 Entry_8: Name: Nmap Web Vuln Scan Description: Tailored Nmap Scan for web Vulnerabilities Command: nmap -vv --reason -Pn -sV -p {Web_Port} --script=`banner,(http* or ssl*) and not (brute or broadcast or dos or external or http-slowloris* or fuzzer)` {IP} Entry_9: Name: Drupal Description: Drupal Enumeration Notes Note: | git clone https://github.com/immunIT/drupwn.git for low hanging fruit and git clone https://github.com/droope/droopescan.git for deeper enumeration Entry_10: Name: WordPress Description: WordPress Enumeration with WPScan Command: | ?What is the location of the wp-login.php? Example: /Yeet/cannon/wp-login.php wpscan --url {Web_Proto}://{IP}{1} --enumerate ap,at,cb,dbe && wpscan --url {Web_Proto}://{IP}{1} --enumerate u,tt,t,vp --passwords {Big_Passwordlist} -e Entry_11: Name: WordPress Hydra Brute Force Description: Need User (admin is default) Command: hydra -l admin -P {Big_Passwordlist} {IP} -V http-form-post '/wp-login.php:log=^USER^&pwd=^PASS^&wp-submit=Log In&testcookie=1:S=Location' Entry_12: Name: Ffuf Vhost Description: Simple Scan with Ffuf for discovering additional vhosts Command: ffuf -w {Subdomain_List}:FUZZ -u {Web_Proto}://{Domain_Name} -H "Host:FUZZ.{Domain_Name}" -c -mc all {Ffuf_Filters} ``` {{#include ../../banners/hacktricks-training.md}}