coraza-spoa: Coraza engine v3.8.1 (security), SecArgumentsLimit 65536, RC-only publish branch
Build and push coraza-spoa / Build-and-Push (push) Successful in 5m42s
Build and push coraza-spoa / Build-and-Push (push) Successful in 5m42s
Security update of the WAF engine. coraza-spoa v0.7.1 pins
github.com/corazawaf/coraza/v3 v3.7.0, which is affected by the v3.8.x
advisories; several are bypasses of rules WHP enforces, reproduced in WHP's
WAF regression net on v3.7.0:
- GHSA-pc5q-qfxp-ggqv jsDecode octal: Log4Shell with ${ } as \44\173 ... \175
escapes is not seen by the enforced 944150.
- GHSA-5gj4-9gm7-2fx2 JSON key collision: LFI in {"a.b":..} shadowed by a
later {"a":{"b":..}} (or a case/duplicate collision) is not seen by 930120.
- GHSA-x26q-wvhg-fh4m ProcessURI: a raw 0x7f in the query drops ALL ARGS_GET.
- GHSA-w253-m66g-rx24: the LAST Content-Type picked the body processor.
Dockerfile: keep coraza-spoa v0.7.1 and CRS (coraza-coreruleset v4.25.0)
unchanged; upgrade only the engine in place (ARG CORAZA_VERSION=v3.8.1,
go get, verified against go.sum/sum.golang.org). The build fails unless
`go version -m` shows exactly that version in the binary.
config.yaml: Coraza 3.8 enforces SecArgumentsLimit (default 1000) on
urlencoded/JSON bodies and the query string and never inspects arguments
past it. With the default, "1000 filler args + LFI in arg 1001" bypassed
930120 on 3.8.1 (it is blocked on 3.7.0). Upstream's mitigation (deny rules
200004/200005) is in Coraza's own coraza.conf-recommended, not in the one
coraza-coreruleset v4.25.0 embeds (the @coraza.conf-recommended we load).
Set SecArgumentsLimit 65536 (= SecRequestBodyLimit / 2: no accepted body can
reach it, so every argument is inspected as on 3.7) and add 209620/209621:
deny in enforce / log in detect_only if arguments were ever dropped
(ARGUMENTS_LIMIT_REACHED, 3.8-only variable, so it lives in the image).
Workflow: a push to coraza-release/** publishes ONLY :<coraza-spoa/VERSION>-rc
and :<sha> (never :latest), for a staged per-host rollout through WHP's coraza
image pin. Not release/**: that prefix also triggers the edge image build.
main keeps publishing :latest (+ :<version> + :<sha>). New coraza-spoa/VERSION
2026.11.1.
Do not merge until the staged rollout is done: merging moves :latest, which
apply-coraza-waf-mode.sh pulls on every unpinned host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
1 parent
2d42ed6c17
commit
4a453df83e
5 files changed
+106
-4
No files matched your search
@@ -9,6 +9,16 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
# Release candidates: a push to coraza-release/** builds the SAME image
|
||||||
|
# but publishes ONLY :<coraza-spoa/VERSION>-rc and :<sha>, never :latest
|
||||||
|
# and never the plain :<VERSION> (see "Resolve tags"). Deliberately NOT
|
||||||
|
# release/**: that prefix also triggers build-push.yaml (the edge image),
|
||||||
|
# which would re-publish the edge's :<VERSION>-rc tag from this branch.
|
||||||
|
# A candidate is rolled out per host through WHP's coraza image pin
|
||||||
|
# (/etc/whp/coraza-image); :latest moves only with a later main publish,
|
||||||
|
# after the staged rollout succeeded. apply-coraza-waf-mode.sh pulls
|
||||||
|
# :latest on every WAF mode apply, so moving :latest IS a fleet rollout.
|
||||||
|
- 'coraza-release/**'
|
||||||
paths:
|
paths:
|
||||||
- 'coraza-spoa/**'
|
- 'coraza-spoa/**'
|
||||||
- 'scripts/assemble-multiarch-index.sh'
|
- 'scripts/assemble-multiarch-index.sh'
|
||||||
@@ -70,6 +80,31 @@ jobs:
|
|||||||
username: shadowdao
|
username: shadowdao
|
||||||
password: ${{ secrets.GHCR_TOKEN }}
|
password: ${{ secrets.GHCR_TOKEN }}
|
||||||
|
|
||||||
|
# Publishing strategy (mirrors build-push.yaml). main: :latest +
|
||||||
|
# :<version> + :<sha>. coraza-release/**: :<version>-rc + :<sha> ONLY.
|
||||||
|
# Any other ref (e.g. workflow_dispatch on a feature branch) is refused.
|
||||||
|
# <version> is coraza-spoa/VERSION (this image's own YYYY.MM.N, separate
|
||||||
|
# from the edge image's repo-root VERSION).
|
||||||
|
- name: Resolve tags
|
||||||
|
id: tags
|
||||||
|
env:
|
||||||
|
REF: ${{ gitea.ref }}
|
||||||
|
SHA: ${{ gitea.sha }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
VERSION="$(cat coraza-spoa/VERSION)"
|
||||||
|
[[ "$VERSION" =~ ^[0-9]{4}\.[0-9]{2}\.[0-9]+$ ]] || { echo "::error::coraza-spoa/VERSION '$VERSION' is not YYYY.MM.N"; exit 1; }
|
||||||
|
case "$REF" in
|
||||||
|
refs/heads/main)
|
||||||
|
list="latest ${VERSION} ${SHA}" ;;
|
||||||
|
refs/heads/coraza-release/*)
|
||||||
|
list="${VERSION}-rc ${SHA}" ;;
|
||||||
|
*)
|
||||||
|
echo "::error::refusing to publish from ref ${REF} (only main and coraza-release/**)"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
echo "list=${list}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "publishing: ${list}"
|
||||||
|
|
||||||
# amd64: required. Failure here fails the job and publishes nothing, as
|
# amd64: required. Failure here fails the job and publishes nothing, as
|
||||||
# before. Pushed untagged by digest to both registries (same digest in
|
# before. Pushed untagged by digest to both registries (same digest in
|
||||||
# each); the tag is only created by the assemble step below.
|
# each); the tag is only created by the assemble step below.
|
||||||
@@ -97,15 +132,22 @@ jobs:
|
|||||||
PKG_CACHE=${{ steps.pkgcache.outputs.url }}
|
PKG_CACHE=${{ steps.pkgcache.outputs.url }}
|
||||||
outputs: type=image,"name=repo.anhonesthost.net/cloud-hosting-platform/coraza-spoa,ghcr.io/shadowdao/coraza-spoa",push-by-digest=true,name-canonical=true,push=true
|
outputs: type=image,"name=repo.anhonesthost.net/cloud-hosting-platform/coraza-spoa,ghcr.io/shadowdao/coraza-spoa",push-by-digest=true,name-canonical=true,push=true
|
||||||
|
|
||||||
- name: Assemble :latest index
|
- name: Assemble multi-arch index
|
||||||
env:
|
env:
|
||||||
AMD64_DIGEST: ${{ steps.amd64.outputs.digest }}
|
AMD64_DIGEST: ${{ steps.amd64.outputs.digest }}
|
||||||
ARM64_DIGEST: ${{ steps.arm64.outputs.digest }}
|
ARM64_DIGEST: ${{ steps.arm64.outputs.digest }}
|
||||||
ARM64_OUTCOME: ${{ steps.arm64.outcome }}
|
ARM64_OUTCOME: ${{ steps.arm64.outcome }}
|
||||||
|
TAG_LIST: ${{ steps.tags.outputs.list }}
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
tag_args=()
|
||||||
|
for t in $TAG_LIST; do tag_args+=(--tag "$t"); done
|
||||||
|
[ ${#tag_args[@]} -gt 0 ] || { echo "::error::no tags resolved"; exit 1; }
|
||||||
scripts/assemble-multiarch-index.sh \
|
scripts/assemble-multiarch-index.sh \
|
||||||
--amd64 "$AMD64_DIGEST" \
|
--amd64 "$AMD64_DIGEST" \
|
||||||
--arm64 "$ARM64_DIGEST" --arm64-outcome "$ARM64_OUTCOME" \
|
--arm64 "$ARM64_DIGEST" --arm64-outcome "$ARM64_OUTCOME" \
|
||||||
--repo repo.anhonesthost.net/cloud-hosting-platform/coraza-spoa \
|
--repo repo.anhonesthost.net/cloud-hosting-platform/coraza-spoa \
|
||||||
--repo ghcr.io/shadowdao/coraza-spoa \
|
--repo ghcr.io/shadowdao/coraza-spoa \
|
||||||
--tag latest
|
"${tag_args[@]}"
|
||||||
|
echo "amd64 digest: $AMD64_DIGEST"
|
||||||
|
echo "arm64 digest: ${ARM64_DIGEST:-<none>} (${ARM64_OUTCOME})"
|
||||||
@@ -11,6 +11,20 @@
|
|||||||
|
|
||||||
ARG CORAZA_SPOA_VERSION=v0.7.1
|
ARG CORAZA_SPOA_VERSION=v0.7.1
|
||||||
|
|
||||||
|
# Coraza engine override (security): coraza-spoa v0.7.1 pins
|
||||||
|
# github.com/corazawaf/coraza/v3 v3.7.0, which is affected by the v3.8.x
|
||||||
|
# advisories (jsDecode octal bypass GHSA-pc5q-qfxp-ggqv, JSON key-collision
|
||||||
|
# bypass GHSA-5gj4-9gm7-2fx2, ProcessURI dropping ARGS_GET GHSA-x26q-wvhg-fh4m,
|
||||||
|
# first-Content-Type desync GHSA-w253-m66g-rx24, ...). The engine is upgraded
|
||||||
|
# IN PLACE (go get of this exact version, verified against go.sum /
|
||||||
|
# sum.golang.org) instead of moving to coraza-spoa v0.9.x, so the SPOA agent
|
||||||
|
# and coraza-coreruleset (CRS 4.25.0) stay exactly what WHP's WAF regression
|
||||||
|
# net (scripts/tests/waf-regression in the WHP repo) measures; only the
|
||||||
|
# engine changes. The build FAILS if the binary does not embed this version.
|
||||||
|
# Behaviour changes that matter are documented in config.yaml
|
||||||
|
# (SecArgumentsLimit) and in the WHP PR that moved the regression net.
|
||||||
|
ARG CORAZA_VERSION=v3.8.1
|
||||||
|
|
||||||
# golang:1.25 from the in-house mirror. The 2026-05-12 Cloudflare incident
|
# golang:1.25 from the in-house mirror. The 2026-05-12 Cloudflare incident
|
||||||
# took out docker.io blob pulls TWICE in one day (first for python:3.12-slim,
|
# took out docker.io blob pulls TWICE in one day (first for python:3.12-slim,
|
||||||
# then for this image's golang:1.25), so both are mirrored at
|
# then for this image's golang:1.25), so both are mirrored at
|
||||||
@@ -24,6 +38,7 @@ ARG CORAZA_SPOA_VERSION=v0.7.1
|
|||||||
# the final distroless stage is per target platform (gcr.io publishes arm64).
|
# the final distroless stage is per target platform (gcr.io publishes arm64).
|
||||||
FROM --platform=$BUILDPLATFORM repo.anhonesthost.net/cloud-hosting-platform/golang:1.25 AS build
|
FROM --platform=$BUILDPLATFORM repo.anhonesthost.net/cloud-hosting-platform/golang:1.25 AS build
|
||||||
ARG CORAZA_SPOA_VERSION
|
ARG CORAZA_SPOA_VERSION
|
||||||
|
ARG CORAZA_VERSION
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
# OPTIONAL internal package cache, e.g. --build-arg PKG_CACHE=https://192.168.1.40
|
# OPTIONAL internal package cache, e.g. --build-arg PKG_CACHE=https://192.168.1.40
|
||||||
@@ -49,8 +64,10 @@ RUN /usr/local/sbin/pkg-cache-repos.sh apt \
|
|||||||
RUN git clone --depth 1 --branch "${CORAZA_SPOA_VERSION}" \
|
RUN git clone --depth 1 --branch "${CORAZA_SPOA_VERSION}" \
|
||||||
https://github.com/corazawaf/coraza-spoa.git . \
|
https://github.com/corazawaf/coraza-spoa.git . \
|
||||||
&& eval "$(/usr/local/sbin/pkg-cache-repos.sh go-env)" \
|
&& eval "$(/usr/local/sbin/pkg-cache-repos.sh go-env)" \
|
||||||
|
&& go get "github.com/corazawaf/coraza/v3@${CORAZA_VERSION}" \
|
||||||
&& go mod download \
|
&& go mod download \
|
||||||
&& CGO_ENABLED=0 GOOS="${TARGETOS:-linux}" GOARCH="${TARGETARCH:-amd64}" go build -trimpath -ldflags='-s -w' -o /out/coraza-spoa . \
|
&& CGO_ENABLED=0 GOOS="${TARGETOS:-linux}" GOARCH="${TARGETARCH:-amd64}" go build -trimpath -ldflags='-s -w' -o /out/coraza-spoa . \
|
||||||
|
&& go version -m /out/coraza-spoa | grep -E "^[[:space:]]+dep[[:space:]]+github.com/corazawaf/coraza/v3[[:space:]]+${CORAZA_VERSION}[[:space:]]" \
|
||||||
&& /usr/local/sbin/pkg-cache-repos.sh restore
|
&& /usr/local/sbin/pkg-cache-repos.sh restore
|
||||||
|
|
||||||
# Catalog extractor: walks the bundled CRS at build time and emits
|
# Catalog extractor: walks the bundled CRS at build time and emits
|
||||||
|
|||||||
@@ -65,8 +65,14 @@ CRS rules are bundled into the coraza-spoa binary at build time, so the CRS vers
|
|||||||
1. Check upstream releases: <https://github.com/corazawaf/coraza-spoa/releases>
|
1. Check upstream releases: <https://github.com/corazawaf/coraza-spoa/releases>
|
||||||
2. Skim the CHANGELOG for new/changed rules in the `overrides.conf` ID ranges.
|
2. Skim the CHANGELOG for new/changed rules in the `overrides.conf` ID ranges.
|
||||||
3. Bump `ARG CORAZA_SPOA_VERSION` in the Dockerfile.
|
3. Bump `ARG CORAZA_SPOA_VERSION` in the Dockerfile.
|
||||||
4. Push to `main` — the Gitea workflow at `.gitea/workflows/build-push-coraza.yaml` rebuilds + pushes `:latest`.
|
4. The Coraza ENGINE is pinned separately (`ARG CORAZA_VERSION`, upgraded in place with `go get`; the build fails if the
|
||||||
5. On each host, run `container-manager.sh recreate coraza-spoa` to pull the new image.
|
binary does not embed it). Move it together with WHP's WAF regression net (`scripts/tests/waf-regression` +
|
||||||
|
`scripts/tests/coraza-body-parse-harness` go.mod in the WHP repo), which must pass on the new engine first.
|
||||||
|
5. Bump `coraza-spoa/VERSION` (YYYY.MM.N) and push a `coraza-release/<anything>` branch: CI publishes ONLY
|
||||||
|
`:<VERSION>-rc` and `:<sha>` (never `:latest`). Roll it out host by host with WHP's coraza image pin
|
||||||
|
(`/etc/whp/coraza-image`, then `container-manager.sh recreate coraza-spoa`).
|
||||||
|
6. Only after the staged rollout, merge to `main`: CI then publishes `:latest` + `:<VERSION>` + `:<sha>`. Moving
|
||||||
|
`:latest` IS a fleet-wide rollout: `apply-coraza-waf-mode.sh` pulls `:latest` on every WAF mode apply on unpinned hosts.
|
||||||
|
|
||||||
## Tuning false positives
|
## Tuning false positives
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
2026.11.1
|
||||||
@@ -57,6 +57,42 @@ applications:
|
|||||||
# trees that could not be sampled. Depth 64 itself costs ~21 ms.
|
# trees that could not be sampled. Depth 64 itself costs ~21 ms.
|
||||||
SecRequestBodyJsonDepthLimit 64
|
SecRequestBodyJsonDepthLimit 64
|
||||||
|
|
||||||
|
# Argument-count limit, per source (ARGS_GET, ARGS_POST, ARGS_PATH).
|
||||||
|
# Coraza 3.8 started ENFORCING SecArgumentsLimit (default 1000) on
|
||||||
|
# urlencoded and JSON bodies and on the query string: parsing stops at
|
||||||
|
# the limit, ARGUMENTS_LIMIT_REACHED is set, and every argument after it
|
||||||
|
# is never inspected (GHSA-3ww9-vw83-9w5x). Coraza <= 3.7 inspected every
|
||||||
|
# urlencoded/JSON argument. With the default, "1000 filler args + an
|
||||||
|
# LFI in arg 1001" bypassed 930120 (an enforced rule) on 3.8.1 in WHP's
|
||||||
|
# regression net. Upstream pairs the cap with deny rules 200004/200005,
|
||||||
|
# but those live in Coraza's own coraza.conf-recommended; the
|
||||||
|
# @coraza.conf-recommended Included above is the one embedded in
|
||||||
|
# coraza-coreruleset v4.25.0, which predates them.
|
||||||
|
# 65536 = SecRequestBodyLimit / 2: a urlencoded pair is at least two
|
||||||
|
# bytes ("a&"), so no body we accept can reach the limit, and the query
|
||||||
|
# string is bounded by tune.bufsize (16 KB) far below it. Every argument
|
||||||
|
# is therefore inspected, exactly as on 3.7. Memory stays bounded by
|
||||||
|
# the body limit (the reason upstream added the cap). WHP's JSON
|
||||||
|
# argument-count guard (991900030/031, ">= 1000" in pre-overrides.conf)
|
||||||
|
# is unaffected: it counts what this limit lets through.
|
||||||
|
SecArgumentsLimit 65536
|
||||||
|
|
||||||
|
# Defense in depth for the limit above (unreachable while it is
|
||||||
|
# >= SecRequestBodyLimit / 2): if arguments were ever dropped, Coraza
|
||||||
|
# did not see the whole request. Same two-rule shape as WHP's JSON
|
||||||
|
# guard: 209620 switches the engine on in enforce mode
|
||||||
|
# (tx.whp_enforce_mode, set in phase 1 by WHP's local-overrides.conf),
|
||||||
|
# 209621 denies; in detect_only it only logs (audit-logged). Phase 2
|
||||||
|
# and placed before pre-overrides/CRS so it runs before every CRS
|
||||||
|
# phase-2 rule. ARGUMENTS_LIMIT_REACHED exists only on Coraza >= 3.8,
|
||||||
|
# which is why this lives in the image, not in WHP's rendered files.
|
||||||
|
SecRule TX:whp_enforce_mode "@eq 1" \
|
||||||
|
"id:209620,phase:2,pass,nolog,t:none,chain"
|
||||||
|
SecRule ARGUMENTS_LIMIT_REACHED "@eq 1" \
|
||||||
|
"t:none,ctl:ruleEngine=On"
|
||||||
|
SecRule ARGUMENTS_LIMIT_REACHED "@eq 1" \
|
||||||
|
"id:209621,phase:2,deny,status:400,log,t:none,msg:'Argument limit reached: arguments were dropped uninspected',tag:'whp/coraza-arguments-limit',ctl:auditEngine=On"
|
||||||
|
|
||||||
Include @crs-setup.conf.example
|
Include @crs-setup.conf.example
|
||||||
|
|
||||||
# Runtime-managed PRE-CRS exclusions written by WHP UI. Empty by default.
|
# Runtime-managed PRE-CRS exclusions written by WHP UI. Empty by default.
|
||||||
|
|||||||
Reference in new issue
Block a user