Skip to content

ewen-lbh/ffcss Late-Unicode normalization vulnerability

Moderate severity GitHub Reviewed Published Dec 28, 2023 in ewen-lbh/ffcss • Updated Mar 1, 2024

Package

gomod github.com/ewen-lbh/ffcss (Go)

Affected versions

< 0.2.0

Patched versions

0.2.0

Description

Summary

The function lookupPreprocess() is meant to apply some transformations to a string by disabling characters in the regex [-_ .]. However, due to the use of late Unicode normalization of type NFKD, it is possible to bypass that validation and re-introduce all the characters in the regex [-_ .].

// lookupPreprocess applies transformations to s so that it can be compared
// to search for something.
// For example, it is used by (ThemeStore).Lookup
func lookupPreprocess(s string) string {
	return strings.ToLower(norm.NFKD.String(regexp.MustCompile(`[-_ .]`).ReplaceAllString(s, "")))
}

Take the following equivalent Unicode character U+2024 (․). Initially, the lookupPreprocess() function would compile the regex and replace the regular dot (.). However, the U+2024 (․) would bypass the ReplaceAllString(). When the normalization operation is applied to U+2024 (․), the resulting character will be U+002E (.). Thus, the dot was reintroduced back.

Impact

The lookupPreprocess() can be easily bypassed with equivalent Unicode characters like U+FE4D (﹍), which would result in the omitted U+005F (_), for instance. It should be noted here that the variable s is user-controlled data coming from /cmd/ffcss/commands.go#L22-L28 the command args. The lookupPreprocess() function is only ever used to search for themes loosely (case insensitively, while ignoring dashes, underscores and dots), so the actual security impact is classified as low.

Remediation

A simple fix would be to initially perform the Unicode normalization and then the rest of validations.

References

References

@ewen-lbh ewen-lbh published to ewen-lbh/ffcss Dec 28, 2023
Published by the National Vulnerability Database Dec 28, 2023
Published to the GitHub Advisory Database Dec 28, 2023
Reviewed Dec 28, 2023
Last updated Mar 1, 2024

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
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
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:L/PR:N/UI:N/S:U/C:N/I:L/A:N

EPSS score

0.053%
(23rd percentile)

CVE ID

CVE-2023-52081

GHSA ID

GHSA-wpmx-564x-h2mh

Source code

Credits

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