Cntlm
Proxy HTTP d'authentification NTLM/NTLMv2 qui permet aux outils ne gérant que la basic-auth de traverser un proxy NTLM d'entreprise ; utile aussi pour des scénarios de relais d'identifiants. NTLM/NTLMv2 authenticating HTTP proxy that lets basic-auth-only tools traverse a corporate NTLM proxy; also useful for credential relay scenarios.
↗ https://github.com/versat/cntlmOverview
Cntlm sits between a client tool and an upstream corporate proxy that requires NTLM authentication, handling the NTLM handshake so the client only needs to speak plain HTTP or basic auth. During engagements it’s commonly used to give command-line tools (curl, git, package managers) internet access through a locked-down NTLM proxy, and it can also be repurposed to relay or test captured NTLM credentials against a proxy.
Common Usage
Generate a config with hashed credentials (avoids storing cleartext password)
cntlm -H -u '<domain>\<username>' -d <domain>
Run cntlm in the foreground using a config file
cntlm -c cntlm.conf -f
Run as a daemon, listening locally for client connections
cntlm -c cntlm.conf
# Point a tool at the local Cntlm listener instead of the real proxy
export http_proxy=http://127.0.0.1:3128
curl http://example.com
Example Config
# cntlm.conf
Username jsmith
Domain CORP
PassNTLMv2 <hash_from_cntlm_-H>
Proxy 10.10.10.5:8080
Listen 3128
Tips
- Use
-Honce to generate password hashes and paste them into the config — never store the cleartext password on disk - Cntlm can also be pointed at a target proxy to test whether a captured NTLM hash (from Responder, etc.) is valid, without needing the cleartext password
- Useful on Windows jump boxes during internal engagements where only the corporate NTLM proxy has outbound access
Help / Man page
Usage: cntlm [options]
Options:
-c FILE Config file to use
-u USER Username (domain\user or user@domain)
-d DOMAIN NTLM domain
-p PASSWORD Password (avoid; prefer -H to generate hashes)
-H Generate password hashes for the config file, then exit
-P FILE Save PID to file
-l PORT Local listening port(s), can specify multiple
-f Run in foreground (don't daemonize), verbose
-M HOST Perform NTLM auth negotiation test against HOST
-v Print version
Vue d’ensemble
Cntlm s’intercale entre un outil client et un proxy d’entreprise en amont qui exige une authentification NTLM, en gérant le handshake NTLM pour que le client n’ait qu’à parler HTTP simple ou basic auth. Pendant les missions, il sert couramment à donner un accès internet à des outils en ligne de commande (curl, git, gestionnaires de paquets) à travers un proxy NTLM verrouillé, et il peut aussi être détourné pour relayer ou tester des identifiants NTLM capturés contre un proxy.
Utilisation courante
# Générer une config avec des identifiants hachés (évite de stocker le mot de passe en clair)
cntlm -H -u '<domain>\<username>' -d <domain>
# Lancer cntlm au premier plan avec un fichier de config
cntlm -c cntlm.conf -f
# Lancer comme démon, en écoutant localement les connexions clientes
cntlm -c cntlm.conf
# Pointer un outil vers le listener Cntlm local au lieu du vrai proxy
export http_proxy=http://127.0.0.1:3128
curl http://example.com
Exemple de config
# cntlm.conf
Username jsmith
Domain CORP
PassNTLMv2 <hash_from_cntlm_-H>
Proxy 10.10.10.5:8080
Listen 3128
Conseils
- Utilisez
-Hune fois pour générer les empreintes de mot de passe et collez-les dans la config : ne stockez jamais le mot de passe en clair sur le disque - Cntlm peut aussi être pointé vers un proxy cible pour tester si une empreinte NTLM capturée (via Responder, etc.) est valide, sans avoir besoin du mot de passe en clair
- Utile sur les jump boxes Windows lors de missions internes, où seul le proxy NTLM d’entreprise a un accès sortant
Aide / Page de manuel
Usage: cntlm [options]
Options:
-c FILE Config file to use
-u USER Username (domain\user or user@domain)
-d DOMAIN NTLM domain
-p PASSWORD Password (avoid; prefer -H to generate hashes)
-H Generate password hashes for the config file, then exit
-P FILE Save PID to file
-l PORT Local listening port(s), can specify multiple
-f Run in foreground (don't daemonize), verbose
-M HOST Perform NTLM auth negotiation test against HOST
-v Print version