CVE-2024-34158
High · 7.5CVSS
7.5
EPSS
1.0%
Published
Sep 6, 2024
CISA due date
—
Cloudanix analysis
A flaw in the Caddy web server software allows an attacker to remotely crash it, taking websites offline.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Denial of service
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
A specially crafted build tag line with deeply nested expressions can cause stack exhaustion when parsed by the application. This leads to a panic, which abruptly terminates the process, resulting in a denial of service (DoS).
Why it matters to the business
An attacker can remotely crash the Caddy web server, making any websites or services it hosts unavailable. This can lead to service outages, loss of customer trust, and potential revenue impact. The vulnerability is network-exploitable without authentication, making any exposed, unpatched server a target.
How an attack unfolds
An unauthenticated remote attacker crafts a request or configuration containing a malicious Go build tag comment, such as "// +build". This comment is engineered with deeply nested logical expressions. When the vulnerable Caddy server attempts to parse this input, the parsing function calls itself recursively for each level of nesting. This quickly consumes all available stack memory, causing a stack overflow. The Go runtime detects this condition and triggers a panic, which immediately crashes the entire Caddy process, taking all hosted services offline.
How to fix it
To remediate this vulnerability, upgrade the 'github.com/caddyserver/caddy/v2' Go module to version '2.5.0-beta.1' or later. Rebuild and redeploy any applications that depend on this module. If using a pre-compiled Caddy binary, ensure it is updated to a version that includes this fix.
How to confirm the fix worked
To validate the fix, check the version of the Caddy server or the 'github.com/caddyserver/caddy/v2' module in your project's dependencies. Ensure the version is '2.5.0-beta.1' or higher. You can typically verify the running version of a Caddy binary by executing a command like `caddy version`.
Typical attack path
- The attacker identifies a publicly accessible server running a vulnerable version of Caddy.
- The attacker crafts a payload containing a "// +build" comment with a large number of nested expressions.
- The attacker sends this payload to the server through any endpoint or mechanism that causes the server to parse it.
- The Caddy server's parser enters a deep recursion while processing the malicious input.
- The call stack is exhausted, triggering a panic that terminates the Caddy process.
- The websites and applications served by the Caddy instance become unavailable.
How to detect it
An exploit attempt will manifest as an unexpected crash of the Caddy process. Review application and system logs for panic messages originating from the Caddy service. Specifically, look for errors indicating a stack overflow, such as "panic: runtime error: stack overflow". Correlate these crashes with any inbound requests or configuration changes that may have contained a malformed "// +build" comment.
- log_message: "panic: runtime error: stack overflow"
What your security team should do
- Immediately identify and patch all internet-facing Caddy instances to a non-vulnerable version.
- Scan your organization's codebase to find all projects using the 'github.com/caddyserver/caddy/v2' Go module and plan for their upgrade.
- Implement robust monitoring and alerting for unexpected service crashes to ensure rapid response and recovery from any potential DoS attacks.
The record
Calling Parse on a "// +build" build tag line with deeply nested expressions can cause a panic due to stack exhaustion.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Go | stdlib | 0 | 1.22.7 |
| AlmaLinux:8 | aardvark-dns | 0 | 2:1.10.1-2.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | buildah | 0 | 2:1.33.8-4.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | buildah | 0 | 2:1.33.8-4.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | buildah-tests | 0 | 2:1.33.8-4.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | buildah-tests | 0 | 2:1.33.8-4.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | cockpit-podman | 0 | 84.1-1.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | conmon | 0 | 3:2.1.10-1.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | conmon | 0 | 3:2.1.10-1.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | conmon | 0 | 3:2.1.10-1.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | conmon | 0 | 3:2.1.10-1.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | container-selinux | 0 | 2:2.229.0-2.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | containernetworking-plugins | 0 | 1:1.4.0-5.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | containernetworking-plugins | 0 | 1:1.4.0-5.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | containers-common | 0 | 2:1-82.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | containers-common | 0 | 2:1-82.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | crit | 0 | 3.18-5.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | crit | 0 | 3.18-5.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | crit | 0 | 3.18-5.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | criu | 0 | 3.18-5.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | criu | 0 | 3.18-5.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | criu-devel | 0 | 3.18-5.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | criu-devel | 0 | 3.18-5.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | criu-libs | 0 | 3.18-5.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | criu-libs | 0 | 3.18-5.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | crun | 0 | 1.14.3-2.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | crun | 0 | 1.14.3-2.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | crun | 0 | 1.14.3-2.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | delve | 0 | 1.21.2-4.module_el8.10.0+3895+92d465e0 |
| AlmaLinux:8 | fuse-overlayfs | 0 | 1.13-1.module_el8.10.0+3792+03eaed9c |
| AlmaLinux:8 | fuse-overlayfs | 0 | 1.13-1.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | go-toolset | 0 | 1.21.13-1.module_el8.10.0+3895+92d465e0 |
| AlmaLinux:8 | golang | 0 | 1.21.13-2.module_el8.10.0+3895+92d465e0 |
| AlmaLinux:8 | golang-bin | 0 | 1.21.13-2.module_el8.10.0+3895+92d465e0 |
| AlmaLinux:8 | golang-docs | 0 | 1.21.13-2.module_el8.10.0+3895+92d465e0 |
| AlmaLinux:8 | golang-misc | 0 | 1.21.13-2.module_el8.10.0+3895+92d465e0 |
| AlmaLinux:8 | golang-src | 0 | 1.21.13-2.module_el8.10.0+3895+92d465e0 |
| AlmaLinux:8 | golang-tests | 0 | 1.21.13-2.module_el8.10.0+3895+92d465e0 |
| AlmaLinux:8 | libslirp | 0 | 4.4.0-2.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | libslirp | 0 | 4.4.0-2.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | libslirp | 0 | 4.4.0-2.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | libslirp-devel | 0 | 4.4.0-2.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | libslirp-devel | 0 | 4.4.0-2.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | libslirp-devel | 0 | 4.4.0-2.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | libslirp-devel | 0 | 4.4.0-2.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | netavark | 0 | 2:1.10.3-1.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | netavark | 0 | 2:1.10.3-1.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | netavark | 0 | 2:1.10.3-1.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | oci-seccomp-bpf-hook | 0 | 1.2.10-1.module_el8.10.0+3792+03eaed9c |
| AlmaLinux:8 | oci-seccomp-bpf-hook | 0 | 1.2.10-1.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | podman | 0 | 4:4.9.4-13.module_el8.10.0+3898+7a25cb1a |
| AlmaLinux:8 | podman | 0 | 4:4.9.4-13.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | podman-catatonit | 0 | 4:4.9.4-13.module_el8.10.0+3898+7a25cb1a |
| AlmaLinux:8 | podman-catatonit | 0 | 4:4.9.4-13.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | podman-docker | 0 | 4:4.9.4-13.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | podman-gvproxy | 0 | 4:4.9.4-13.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | podman-plugins | 0 | 4:4.9.4-13.module_el8.10.0+3898+7a25cb1a |
| AlmaLinux:8 | podman-plugins | 0 | 4:4.9.4-13.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | podman-remote | 0 | 4:4.9.4-13.module_el8.10.0+3898+7a25cb1a |
| AlmaLinux:8 | podman-remote | 0 | 4:4.9.4-13.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | podman-tests | 0 | 4:4.9.4-13.module_el8.10.0+3898+7a25cb1a |
| AlmaLinux:8 | podman-tests | 0 | 4:4.9.4-13.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | python3-criu | 0 | 3.18-5.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | python3-criu | 0 | 3.18-5.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | python3-criu | 0 | 3.18-5.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | python3-podman | 0 | 4.9.0-2.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | runc | 0 | 1:1.1.12-5.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | skopeo | 0 | 2:1.14.5-3.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | skopeo | 0 | 2:1.14.5-3.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | skopeo-tests | 0 | 2:1.14.5-3.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | skopeo-tests | 0 | 2:1.14.5-3.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | slirp4netns | 0 | 1.2.3-1.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | slirp4netns | 0 | 1.2.3-1.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | slirp4netns | 0 | 1.2.3-1.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | toolbox | 0 | 0.0.99.5-2.module_el8.10.0+3845+87b84552 |
| AlmaLinux:8 | toolbox | 0 | 0.0.99.5-2.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | toolbox | 0 | 0.0.99.5-2.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | toolbox | 0 | 0.0.99.5-2.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | toolbox-tests | 0 | 0.0.99.5-2.module_el8.10.0+3858+6ad51f9f |
| AlmaLinux:8 | toolbox-tests | 0 | 0.0.99.5-2.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:8 | toolbox-tests | 0 | 0.0.99.5-2.module_el8.10.0+3901+4b80ecd7 |
| AlmaLinux:8 | udica | 0 | 0.2.6-21.module_el8.10.0+3876+e55593a8 |
| AlmaLinux:9 | buildah | 0 | 2:1.33.9-1.el9_4 |
| AlmaLinux:9 | buildah | 0 | 2:1.37.5-1.el9_5 |
| AlmaLinux:9 | buildah-tests | 0 | 2:1.33.9-1.el9_4 |
| AlmaLinux:9 | buildah-tests | 0 | 2:1.37.5-1.el9_5 |
| AlmaLinux:9 | go-toolset | 0 | 1.21.13-3.el9_4 |
| AlmaLinux:9 | golang | 0 | 1.21.13-3.el9_4 |
| AlmaLinux:9 | golang-bin | 0 | 1.21.13-3.el9_4 |
| AlmaLinux:9 | golang-docs | 0 | 1.21.13-3.el9_4 |
| AlmaLinux:9 | golang-misc | 0 | 1.21.13-3.el9_4 |
| AlmaLinux:9 | golang-src | 0 | 1.21.13-3.el9_4 |
| AlmaLinux:9 | golang-tests | 0 | 1.21.13-3.el9_4 |
| AlmaLinux:9 | osbuild | 0 | 141-1.el9.alma.1 |
| AlmaLinux:9 | osbuild-composer | 0 | 132-1.el9.alma.1 |
| AlmaLinux:9 | osbuild-composer-core | 0 | 132-1.el9.alma.1 |
| AlmaLinux:9 | osbuild-composer-worker | 0 | 132-1.el9.alma.1 |
| AlmaLinux:9 | osbuild-depsolve-dnf | 0 | 141-1.el9.alma.1 |
| AlmaLinux:9 | osbuild-luks2 | 0 | 141-1.el9.alma.1 |
| AlmaLinux:9 | osbuild-lvm2 | 0 | 141-1.el9.alma.1 |
| AlmaLinux:9 | osbuild-ostree | 0 | 141-1.el9.alma.1 |
| AlmaLinux:9 | osbuild-selinux | 0 | 141-1.el9.alma.1 |
| AlmaLinux:9 | podman | 0 | 4:4.9.4-13.el9_4 |
| AlmaLinux:9 | podman | 0 | 4:5.2.2-9.el9_5 |
| AlmaLinux:9 | podman-docker | 0 | 4:4.9.4-13.el9_4 |
| AlmaLinux:9 | podman-docker | 0 | 4:5.2.2-9.el9_5 |
| AlmaLinux:9 | podman-plugins | 0 | 4:4.9.4-13.el9_4 |
| AlmaLinux:9 | podman-plugins | 0 | 4:5.2.2-9.el9_5 |
| AlmaLinux:9 | podman-remote | 0 | 4:4.9.4-13.el9_4 |
| AlmaLinux:9 | podman-remote | 0 | 4:5.2.2-9.el9_5 |
| AlmaLinux:9 | podman-tests | 0 | 4:4.9.4-13.el9_4 |
| AlmaLinux:9 | podman-tests | 0 | 4:5.2.2-9.el9_5 |
| AlmaLinux:9 | python3-osbuild | 0 | 141-1.el9.alma.1 |
| Bitnami | golang | 0 | 1.22.7 |
| Chainguard | aactl | 0 | 0.4.12-r18 |
| Chainguard | actions-runner-controller | 0 | 0.9.3-r2 |
| Chainguard | actions-runner-controller-compat | 0 | 0.9.3-r2 |
| Chainguard | actions-runner-controller-fips | 0 | 0.9.3-r2 |
| Chainguard | actions-runner-controller-fips-compat | 0 | 0.9.3-r2 |
| Chainguard | addon-resizer | 0 | 1.8.22-r2 |
| Chainguard | addon-resizer-compat | 0 | 1.8.22-r2 |
| Chainguard | addon-resizer-fips | 0 | 1.8.22-r2 |
| Chainguard | addon-resizer-fips-compat | 0 | 1.8.22-r2 |
| Chainguard | age | 0 | 1.2.0-r2 |
| Chainguard | amass | 0 | 4.2.0-r13 |
| Chainguard | apache-beam-java-11-sdk | 0 | 2.63.0-r1 |
| Chainguard | apache-beam-java-17-sdk | 0 | 2.63.0-r1 |
| Chainguard | apache-beam-java-21-sdk | 0 | 2.63.0-r1 |
| Chainguard | apache-beam-java-sdk | 0 | 2.63.0-r1 |
| Chainguard | apache-beam-python-3.11-sdk | 0 | 2.58.1-r1 |
| Chainguard | apko | 0 | 0.18.0-r0 |
| Chainguard | argo-cd-2.10 | 0 | 2.10.16-r1 |
| Chainguard | argo-cd-2.10-compat | 0 | 2.10.16-r1 |
| Chainguard | argo-cd-2.10-repo-server | 0 | 2.10.16-r1 |
| Chainguard | argo-cd-2.11 | 0 | 2.11.8-r0 |
| Chainguard | argo-cd-2.11-compat | 0 | 2.11.8-r0 |
| Chainguard | argo-cd-2.11-repo-server | 0 | 2.11.8-r0 |
| Chainguard | argo-cd-2.12 | 0 | 2.12.3-r1 |
| Chainguard | argo-cd-2.12-compat | 0 | 2.12.3-r1 |
| Chainguard | argo-cd-2.12-repo-server | 0 | 2.12.3-r1 |
| Chainguard | argo-cd-fips-2.10 | 0 | 2.10.16-r2 |
| Chainguard | argo-cd-fips-2.10-compat | 0 | 2.10.16-r2 |
| Chainguard | argo-cd-fips-2.10-repo-server | 0 | 2.10.16-r2 |
| Chainguard | argo-cd-fips-2.11 | 0 | 2.11.8-r0 |
| Chainguard | argo-cd-fips-2.11-compat | 0 | 2.11.8-r0 |
| Chainguard | argo-cd-fips-2.11-repo-server | 0 | 2.11.8-r0 |
| Chainguard | argo-cd-fips-2.12 | 0 | 2.12.3-r1 |
| Chainguard | argo-cd-fips-2.12-compat | 0 | 2.12.3-r1 |
| Chainguard | argo-cd-fips-2.12-repo-server | 0 | 2.12.3-r1 |
| Chainguard | argo-workflow-cli | 0 | 3.6.5-r2 |
| Chainguard | argo-workflow-cli-fips | 0 | 3.6.5-r2 |
| Chainguard | argo-workflow-controller | 0 | 3.6.5-r2 |
| Chainguard | argo-workflow-controller-compat | 0 | 3.6.5-r2 |
| Chainguard | argo-workflow-controller-compat-fips | 0 | 3.6.5-r2 |
| Chainguard | argo-workflow-controller-fips | 0 | 3.6.5-r2 |
| Chainguard | argo-workflow-executor | 0 | 3.6.5-r2 |
| Chainguard | argo-workflow-executor-compat | 0 | 3.6.5-r2 |
| Chainguard | argo-workflow-executor-compat-fips | 0 | 3.6.5-r2 |
| Chainguard | argo-workflow-executor-fips | 0 | 3.6.5-r2 |
| Chainguard | argo-workflows | 0 | 3.6.5-r2 |
| Chainguard | argo-workflows-fips | 0 | 3.6.5-r2 |
| Chainguard | argo-workflows-known-hosts | 0 | 3.6.5-r2 |
| Chainguard | argo-workflows-known-hosts-fips | 0 | 3.6.5-r2 |
| Chainguard | argo-workflows-ui | 0 | 3.6.5-r2 |
| Chainguard | atlantis | 0 | 0.29.0-r1 |
| Chainguard | atlantis-fips | 0 | 0.29.0-r1 |
| Chainguard | authservice | 0 | 1.0.2-r0 |
| Chainguard | authservice-compat | 0 | 1.0.2-r0 |
| Chainguard | authservice-fips | 0 | 1.0.1-r2 |
| Chainguard | authservice-fips-compat | 0 | 1.0.1-r2 |
| Chainguard | aws-ebs-csi-driver | 0 | 1.34.0-r1 |
| Chainguard | aws-ebs-csi-driver-fips | 0 | 1.34.0-r2 |
| Chainguard | aws-efs-csi-driver | 0 | 2.0.7-r1 |
| Chainguard | aws-efs-csi-driver-fips | 0 | 2.0.7-r1 |
| Chainguard | aws-flb-cloudwatch | 0 | 1.9.4-r13 |
| Chainguard | aws-flb-cloudwatch-compat | 0 | 1.9.4-r13 |
| Chainguard | aws-flb-cloudwatch-compat-fips | 0 | 1.9.4-r6 |
| Chainguard | aws-flb-cloudwatch-fips | 0 | 1.9.4-r6 |
| Chainguard | aws-flb-firehose | 0 | 1.7.2-r13 |
| Chainguard | aws-flb-firehose-compat | 0 | 1.7.2-r13 |
| Chainguard | aws-flb-firehose-compat-fips | 0 | 1.7.2-r6 |
| Chainguard | aws-flb-firehose-fips | 0 | 1.7.2-r6 |
| Chainguard | aws-flb-kinesis | 0 | 1.10.2-r14 |
| Chainguard | aws-flb-kinesis-compat | 0 | 1.10.2-r14 |
| Chainguard | aws-flb-kinesis-compat-fips | 0 | 1.10.2-r7 |
| Chainguard | aws-flb-kinesis-fips | 0 | 1.10.2-r7 |
| Chainguard | aws-load-balancer-controller | 0 | 2.8.2-r1 |
| Chainguard | aws-load-balancer-controller-compat | 0 | 2.8.2-r1 |
| Chainguard | aws-load-balancer-controller-fips | 0 | 2.8.2-r2 |
| Chainguard | aws-network-policy-agent | 0 | 1.1.2-r2 |
| Chainguard | aws-network-policy-agent-compat | 0 | 1.1.2-r2 |
| Chainguard | azcopy | 0 | 10.26.0-r1 |
| Chainguard | azcopy-fips | 0 | 10.26.0-r1 |
| Chainguard | azure-aad-pod-identity-mic | 0 | 1.8.17-r12 |
| Chainguard | azure-aad-pod-identity-nmi | 0 | 1.8.17-r12 |
| Chainguard | bank-vaults | 0 | 1.20.4-r18 |
| Chainguard | bank-vaults-fips | 0 | 1.20.4-r15 |
| Chainguard | bank-vaults-template | 0 | 1.20.4-r18 |
| Chainguard | bank-vaults-template-fips | 0 | 1.20.4-r15 |
| Chainguard | bazelisk | 0 | 1.21.0-r0 |
Related vulnerabilities
- CVE-2025-68121 During session resumption in crypto/tls, if the underlying Config has its ClientCAs or… Also affects stdlib
- CVE-2025-22873 It was possible to improperly access the parent directory of an os.Root by opening a… Also affects stdlib
- GO-2026-4403 Improper access to parent directory of root in os Also affects stdlib
- CVE-2025-61726 The net/url package does not set a limit on the number of query parameters in a query. Also affects stdlib
- CVE-2025-61728 archive/zip uses a super-linear file name indexing algorithm that is invoked the first… Also affects stdlib
- CVE-2025-61730 During the TLS 1.3 handshake if multiple messages are sent in records that span… Also affects stdlib
- CVE-2025-61727 An excluded subdomain constraint in a certificate chain does not restrict the usage of… Also affects stdlib
- CVE-2025-61729 Within HostnameError.Error(), when constructing an error string, there is no limit to the… Also affects stdlib