Skip to content
Crypto Disclosed report Intermediate CVE-2022-32221

[High] MITM via Insecure CA Path Handling in cURL (--capath, CURLOPT_CAPATH) (CWE-494: Download of Code Without Integrity Check)

The report claims that cURL's --capath option accepts any directory without validation, so an attacker who can supply a custom CA path containing a fake root certificate can make cURL trust malicious HTTPS endpoints. This would allow a man-in-the-middle to decrypt HTTPS traffic silently.

oicus Follow

Originally disclosed on HackerOne

  • Disclosed after 2 months

Summary:

The --capath option in cURL and CURLOPT_CAPATH in libcurl accept any directory path without validation. If an attacker provides a custom CA path containing a fake root certificate, cURL will trust malicious HTTPS endpoints signed with that fake root. This allows for full Man-in-the-Middle (MITM) attacks and silent decryption of HTTPS traffic without user warnings.

Affected version

Affected Asset:

Component: cURL CLI and libcurl Versions: 7.82.0 to 8.4.0 Platform: All OS (Linux, macOS, Windows)

Steps To Reproduce:

Works across OS, no user interaction required, and reproducible without root. 1.Create Fake Root CA: openssl req -x509 -newkey rsa:2048 -nodes
-keyout fake.key -out fake.crt
-subj "/CN=FakeMITMRoot" -days 365

2.Prepare a directory: mkdir -p /tmp/fake-ca cp fake.crt /tmp/fake-ca

3.Run vulnerable cURL command: curl --capath /tmp/fake-ca https://example.com

4.If the server’s TLS certificate was signed by this fake CA, cURL connects successfully and exposes decrypted HTTPS data. Environment Tested:

curl 7.85.0 (x86_64-pc-linux-gnu) libcurl/7.85.0 OpenSSL/3.0.2

Supporting Material/References:

References:

CWE-494: https://cwe.mitre.org/data/definitions/494.html Similar CVE: CVE-2022-32221 cURL Docs: https://curl.se/docs/manpage.html

Recommendation:

Add a whitelist or allowlist of trusted CA directories (e.g., /etc/ssl/certs/, /usr/share/ca-certificates/). Warn users if non-standard --capath is used. Consider validating contents with signed manifests or checksum hashes.

Disclosure Policy:

PoC and full exploit details available upon request. I adhere to a 90-day responsible disclosure timeline.

Impact

| Vector | Risk Description |

| MITM & Decryption | Attacker silently decrypts HTTPS (credentials, tokens, sessions). | | Silent Exploitation | No TLS warning shown, making the attack stealthy. | | Cross-Platform Abuse | Affects Linux, Windows, macOS, containers, and CI/CD tools using libcurl. | | Supply Chain Attack | Tools and apps that dynamically set CURLOPT_CAPATH can be abused automatically.|

The original report as published on HackerOne, by oicus. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the --capath option does not validate or restrict the directory path, allowing an attacker-controlled CA directory to be used.

Impact

An attacker could silently decrypt HTTPS traffic, including credentials and tokens, across platforms and in CI/CD tools that use libcurl.

What the attacker needed

Attacker controls the CA directory path; victim uses --capath with that directory; server certificate signed by fake CA

The fix

The report recommends adding a whitelist of trusted CA directories, warning users about non-standard --capath, and validating contents with signed manifests or checksums.

How it was found

  1. Create a fake root CA certificate.
  2. Place the fake certificate in a directory.
  3. Run cURL with --capath pointing to that directory against an HTTPS URL.
  4. If the server's certificate is signed by the fake CA, cURL connects and exposes decrypted data.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

cURL is a tool for transferring data over the internet. It checks that websites are genuine using a list of trusted certificates. The report says cURL lets you point it at any folder of certificates without checking, so if someone can trick you into using a folder with a fake certificate, cURL will trust fake websites and an attacker can read your traffic.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More by oicus

View all

1 more disclosed report, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.