CVE-2021-23772: Link Following in Iris

github.com/kataras/iris/v12 Updated 02 Oct 2025

Summary

15/07/2022
Yes i
High
7.5

CVE-2021-23772: Directory traversal in github.com/kataras/iris and github.com/kataras/iris/v12. Affects github.com/kataras/iris/v12 versions < 12.2.0-alpha8. Fixed in 12.2.0-alpha8. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The package under scrutiny is github.com/kataras/iris, a Go package that provides a fast, simple, and efficient framework for building web applications. It is widely used in the Go ecosystem and offers various features such as routing, middleware, and template rendering. However, all versions of the package are vulnerable to a link following vulnerability. This vulnerability arises from the unsafe handling of file names during file uploads using the UploadFormFiles method. Attackers can exploit this vulnerability to write files to arbitrary locations outside the designated target folder.

Vulnerability Detail

The link following vulnerability in Iris allows attackers to manipulate file names during file uploads, potentially leading to the writing of files in unintended locations. By crafting malicious file names, attackers can bypass the intended target folder and write files to arbitrary locations on the system. This can result in unauthorized access, data leakage, and potential remote code execution. The vulnerability has a CVSS score of 7.5, indicating a high severity level.

How To Fix

Minimum fixed version

12.2.0-alpha8

This is the first release that contains the fix.

go get github.com/kataras/iris/v12@v12.2.0-alpha8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, developers can implement additional validation and sanitization checks on file names during file uploads. This can include restricting the allowed characters, length, and file extensions. By enforcing strict validation, the risk of link following attacks can be mitigated. Here is an example of how to implement file name validation in Go:

func validateFileName(fileName string) bool {
    // Implement your validation logic here
    // Return true if the file name is valid, false otherwise
}

func uploadFileHandler(ctx iris.Context) {
    file, err := ctx.FormFile("file")
    if err != nil {
        // Handle error
        return
    }

    fileName := file.Filename
    if !validateFileName(fileName) {
        // Handle invalid file name
        return
    }

    // Proceed with file upload
}

Conclusion

The link following vulnerability in Iris can have severe consequences, including unauthorized access, data leakage, and potential remote code execution. It is crucial to update to the latest fixed versions of the package to address this vulnerability. Additionally, implementing strict file name validation and sanitization checks can provide temporary mitigation. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for github.com/kataras/iris/v12 →

Share this vulnerability

FAQ

The vulnerability allows attackers to write files to arbitrary locations outside the intended target folder. This can lead to unauthorized access, data leakage, and potential remote code execution.

For github.com/kataras/iris, all versions up to 0.0.2 are affected. For github.com/kataras/iris/v12, all versions up to 12.2.0-alpha8 are affected.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities without requiring access to the code or installation.

Yes, the vulnerability is fixed in version 0.0.3 for github.com/kataras/iris and version 12.2.0-alpha9 for github.com/kataras/iris/v12. It is recommended to update to the latest fixed versions.

As a temporary workaround, you can implement additional validation and sanitization checks on file names during file uploads. This can help mitigate the risk of link following attacks.

References

How To Fix

Minimum fixed version

12.2.0-alpha8

This is the first release that contains the fix.

go get github.com/kataras/iris/v12@v12.2.0-alpha8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback