CVE-2021-23772

7.5 HIGH

📋 TL;DR

This vulnerability in the Iris web framework allows attackers to perform directory traversal attacks during file uploads. By manipulating file names in the UploadFormFiles method, attackers can write files to arbitrary locations outside the intended upload directory. All applications using affected versions of the Iris framework are vulnerable.

💻 Affected Systems

Products:
  • github.com/kataras/iris
  • github.com/kataras/iris/v12
Versions: All versions before the fix
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using the UploadFormFiles method for file uploads. Applications not using file upload functionality are not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution by overwriting critical system files, configuration files, or web application source code, potentially leading to complete system compromise.

🟠

Likely Case

Unauthorized file writes to sensitive directories, potentially enabling data theft, defacement, or privilege escalation through file manipulation.

🟢

If Mitigated

Limited to attempted attacks that are blocked by proper input validation and file system permissions, with no successful exploitation.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploitation requires file upload functionality but no authentication. The vulnerability is straightforward to exploit with basic knowledge of directory traversal techniques.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Fixed in commit e213dba0d32ff66653e0ef124bc5088817264b08

Vendor Advisory: https://github.com/kataras/iris/commit/e213dba0d32ff66653e0ef124bc5088817264b08

Restart Required: Yes

Instructions:

1. Update Iris to version containing commit e213dba0d32ff66653e0ef124bc5088817264b08
2. Run 'go get -u github.com/kataras/iris' or 'go get -u github.com/kataras/iris/v12'
3. Rebuild and redeploy your application
4. Restart the application service

🔧 Temporary Workarounds

Implement custom file upload validation

all

Add server-side validation to sanitize file names and restrict upload paths before calling UploadFormFiles

Disable file upload functionality

all

Temporarily disable file upload features until patching is complete

🧯 If You Can't Patch

  • Implement strict file name validation using allowlists of safe characters
  • Configure file system permissions to restrict write access to only necessary directories

🔍 How to Verify

Check if Vulnerable:

Check if your application uses UploadFormFiles method and review the Iris version in go.mod

Check Version:

grep 'github.com/kataras/iris' go.mod

Verify Fix Applied:

Verify the Iris version includes commit e213dba0d32ff66653e0ef124bc5088817264b08 and test file uploads with malicious file names

📡 Detection & Monitoring

Log Indicators:

  • File upload attempts with suspicious file names containing '../' sequences
  • Unauthorized file write attempts to system directories

Network Indicators:

  • HTTP POST requests to upload endpoints with manipulated file names

SIEM Query:

source="web_logs" AND (method="POST" AND uri="*upload*" AND (filename="*../*" OR filename="*..\\*"))

🔗 References

📤 Share & Export