CVE-2022-27778

8.1 HIGH

📋 TL;DR

This vulnerability in curl versions before 7.83.1 could cause the wrong file to be deleted when using the --no-clobber option with --remove-on-error. It affects systems using curl with these specific flags, potentially leading to unintended file deletion.

💻 Affected Systems

Products:
  • curl
  • libcurl
  • applications using libcurl
Versions: curl versions before 7.83.1
Operating Systems: All operating systems running vulnerable curl versions
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when using both --no-clobber and --remove-on-error flags together.

📦 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

Critical system files could be deleted, causing system instability, data loss, or service disruption.

🟠

Likely Case

User data files or temporary files could be deleted unintentionally, causing data loss or application errors.

🟢

If Mitigated

With proper file permissions and monitoring, impact would be limited to non-critical files with minimal disruption.

🌐 Internet-Facing: LOW - This requires local execution of curl with specific flags, not typically exposed to internet.
🏢 Internal Only: MEDIUM - Scripts or automation tools using curl with these flags could be affected internally.

🎯 Exploit Status

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

Exploitation requires ability to execute curl commands with specific flags. Proof of concept available in HackerOne report.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: curl 7.83.1 and later

Vendor Advisory: https://curl.se/docs/CVE-2022-27778.html

Restart Required: No

Instructions:

1. Check current curl version: curl --version
2. Update curl using system package manager:
- Ubuntu/Debian: sudo apt update && sudo apt upgrade curl
- RHEL/CentOS: sudo yum update curl
- macOS: brew upgrade curl
3. Verify update: curl --version should show 7.83.1 or higher

🔧 Temporary Workarounds

Avoid vulnerable flag combination

all

Do not use --no-clobber together with --remove-on-error flags in curl commands

# Replace: curl --no-clobber --remove-on-error ...
# With: curl --remove-on-error ... (without --no-clobber)

🧯 If You Can't Patch

  • Audit all scripts and automation using curl for --no-clobber --remove-on-error combination
  • Implement file permission restrictions to limit damage from unintended deletions

🔍 How to Verify

Check if Vulnerable:

Run: curl --version | head -1 | grep -q '7\.[0-8][0-2]\.[0-9]' && echo 'VULNERABLE' || echo 'SAFE'

Check Version:

curl --version | head -1

Verify Fix Applied:

Run: curl --version | head -1 | grep -q '7\.8[3-9]\.[0-9]\|7\.[9-9][0-9]\.[0-9]\|8\.[0-9]\.[0-9]' && echo 'PATCHED' || echo 'STILL VULNERABLE'

📡 Detection & Monitoring

Log Indicators:

  • Unexpected file deletions following curl executions
  • Application errors due to missing files after curl operations

Network Indicators:

  • None - this is a local file system vulnerability

SIEM Query:

process.name="curl" AND command_line:"--no-clobber" AND command_line:"--remove-on-error"

🔗 References

📤 Share & Export