Skip to content

compliance-remediate.sh writes to fixed /tmp/_cr_jq_err path, which follows a pre-planted symlink #1387

Closed

Description

@don-petry

The findings parser opens /tmp/_cr_jq_err with a truncating redirection that follows existing symbolic links. A separate local user can preplant that link and cause the remediator to truncate an unrelated file writable by its account.

Location: scripts/compliance-remediate.sh:948
Severity: low · Rule: CWE-61 · Reachability: external
Subsystem: Organization administration and standards deployment

Evidence

  • Source/control: A lower-privilege local user's filesystem entry at /tmp/_cr_jq_err.
  • Sink/decision: The stderr redirection opened before jq processes the findings.
  • Missing mitigation: The stderr destination is neither securely allocated nor protected against following an existing symlink.
Reachability call stack
  1. scripts/compliance-remediate.sh:1019 — main invocation.
  2. scripts/compliance-remediate.sh:903 — validates the findings file and token.
  3. scripts/compliance-remediate.sh:948 — opens /tmp/_cr_jq_err through a truncating shell redirection [sink].

Filed from a CodeRabbit security scan (scan 2d23b5ee-606a-403f-b407-81ddebdb0115, revision 1ea9ee1fbecc). Finding IDs: f1bee4e6-f2fc-4151-8018-f9f6bd665384. CodeRabbit notes that findings relying on its stated assumptions are capped at medium severity; dismiss if an assumption does not hold.

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

    in-progressAn agent is actively working this issuesecuritySecurity-related PRs and issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions