CVE-2020-8177

7.8 HIGH

📋 TL;DR

CVE-2020-8177 is a vulnerability in curl that allows arbitrary file overwrite when using the -J flag. Attackers can overwrite local files by manipulating server responses with crafted filenames. This affects curl versions 7.20.0 through 7.70.0.

💻 Affected Systems

Products:
  • curl
  • libcurl
  • applications using vulnerable libcurl versions
Versions: 7.20.0 through 7.70.0
Operating Systems: Linux, Windows, macOS, Unix-like systems
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when using the -J/--remote-header-name flag. Many applications use libcurl without this flag.

📦 What is this software?

Curl by Haxx

curl is a command-line tool and library for transferring data with URLs. It supports numerous protocols including HTTP, HTTPS, FTP, and more, making it essential for API testing, web scraping, and automated data transfers.

Learn more about Curl →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise through overwriting critical system files like /etc/passwd or authorized_keys, leading to privilege escalation or remote code execution.

🟠

Likely Case

Data loss or corruption through overwriting user files, configuration files, or application data.

🟢

If Mitigated

Limited impact if curl is used without -J flag or with restricted permissions in sandboxed environments.

🌐 Internet-Facing: MEDIUM - Requires user to download files from untrusted sources using curl with -J flag.
🏢 Internal Only: LOW - Typically requires user interaction or script execution with specific flags.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires user to download from malicious server or MITM scenario. Proof of concept available in HackerOne report.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: curl 7.71.0

Vendor Advisory: https://curl.se/docs/CVE-2020-8177.html

Restart Required: No

Instructions:

1. Update curl to version 7.71.0 or later. 2. For Linux: Use package manager (apt-get update && apt-get upgrade curl, yum update curl, etc.). 3. For Windows: Download latest from curl.se. 4. Recompile applications using libcurl with updated version.

🔧 Temporary Workarounds

Disable -J flag usage

all

Avoid using curl with -J/--remote-header-name flag in scripts and commands

# Review scripts and remove -J flag usage
# Example vulnerable: curl -J -O http://example.com/file
# Safe: curl -O http://example.com/file

Restrict curl permissions

linux

Run curl with limited user privileges to reduce impact of file overwrites

sudo -u lowprivilegeuser curl ...
chroot or containerize curl operations

🧯 If You Can't Patch

  • Audit all scripts and applications for curl -J usage and remove the flag
  • Implement network controls to prevent curl from accessing untrusted servers

🔍 How to Verify

Check if Vulnerable:

Check curl version: curl --version | head -1. If version is between 7.20.0 and 7.70.0 inclusive, system is vulnerable when using -J flag.

Check Version:

curl --version | head -1

Verify Fix Applied:

After update, verify version is 7.71.0 or higher: curl --version | head -1

📡 Detection & Monitoring

Log Indicators:

  • curl commands with -J flag in command history
  • Unexpected file modifications in system logs

Network Indicators:

  • curl requests to untrusted domains with -J flag
  • HTTP responses with crafted Content-Disposition headers

SIEM Query:

process_name="curl" AND command_line="* -J *"

🔗 References

📤 Share & Export