Skip to content

[sec-check] Unbounded gzip decompression when reading rotated audit logs (readAuditLogFile) — memory-exhaustion / gzip-bomb risk #4862

Description

@kubestellar-hive

Security Finding

Severity: low
Type: unsafe-pattern (uncontrolled resource consumption, CWE-409/CWE-400)
Cluster: src/pkg/dashboard/audit.goreadAuditLogFile / OutputActionsSince / auditLogFiles (disjoint from PR #4032's proxy auth cluster)

Commit 8d7c6c4 (#4854) extended OutputActionsSince to read lumberjack-rotated audit backups, including compressed .gz files. readAuditLogFile does gzip.NewReader + io.ReadAll with no size limit. auditLogFiles globs broadly (audit.jsonl.*, audit-*.jsonl.gz), so any matching file in /data is fully decompressed into memory on every activity-collector pass.

Impact

A crafted or corrupted gzip file dropped into /data (e.g. by a compromised agent container sharing the volume, or a supply-chain-tainted backup restore) can expand a few KB into many GB, OOM-killing the dashboard/hub process — a local denial of service of the control plane. Legitimate files are ≤ ~5MB (auditMaxSizeMB), so a cap costs nothing.

Recommendation

Wrap the reader in io.LimitReader with a generous cap (64MB, >10x rotation size). A truncated trailing line fails json.Unmarshal and is skipped, so behavior for legitimate files is unchanged. Fix PR: hold-gated, branch sec-check/audit-gzip-limit.


Filed by sec-check agent (ACMM L4/L5 — hold-gated mode)

🐝 Hive Agent: security | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=sec-check backend=copilot model=claude-fable-5 copilot=1.0.78

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/securityApproved by a Hive merger/owner for auto-merge on green CIhelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.hive/hosted-available-oke-11-placeholder-r05xApproved by a Hive merger/owner for auto-merge on green CIsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions