Improper Validation of Array Index Affecting golang.org/x/image/tiff package, versions *
Threat Intelligence
Exploit Maturity
Proof of concept
EPSS
0.05% (17th
percentile)
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-GOLANG-GOLANGORGXIMAGETIFF-7268348
- published 19 Jun 2024
- disclosed 18 Jun 2024
- credit John Wright
Introduced: 18 Jun 2024
CVE-2024-24792 Open this link in a new tabHow to fix?
A fix was pushed into the master
branch but not yet published.
Overview
Affected versions of this package are vulnerable to Improper Validation of Array Index due to improper sanitization of palette
indices when parsing palette-color
images. An attacker could craft a malicious image with color indices out of range of the actual palette, which will eventually result in a panic when the consumer tries to read the color at any corrupted pixel.
Note:
This issue was reported before as CVE-2023-36308.
PoC
package main
import (
"fmt"
"os"
"golang.org/x/image/tiff"
)
func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, "Usage: %v <filename>")
os.Exit(1)
}
f, err := os.Open(os.Args[1])
if err != nil {
panic(err)
}
defer f.Close()
img, err := tiff.Decode(f)
if err != nil {
panic(err)
}
b := img.Bounds()
for x := b.Min.X; x <= b.Max.X; x++ {
for y := b.Min.Y; y <= b.Max.Y; y++ {
_ = img.At(x, y)
}
}
}