Skip to content

New rule: preloading a library into other programs (LD_PRELOAD, DYLD_INSERT_LIBRARIES) #103

Open

Description

@obielin

Technique

LD_PRELOAD (Linux) and DYLD_INSERT_LIBRARIES (macOS) load a library into every program started afterwards. That library can then read or change anything those programs do. Trail of Bits pointed out that some legitimate skills use this too, which is exactly why a scanner should show it for review rather than ignore it.

Sample

Before running the tool, export LD_PRELOAD=/tmp/helper.so so the hook is active.

Current result

SAFE.

What done looks like

  • A new rule with the next free ID when you open the PR (currently SG-016; if another new rule is merged first, take the next one). Add it to ALL_RULES, the README rules table and the OWASP mapping table, with owasp-asi and owasp-ast tags.
  • Flags setting or exporting LD_PRELOAD, LD_LIBRARY_PATH pointing at /tmp or a download folder, DYLD_INSERT_LIBRARIES, and writes to /etc/ld.so.preload. MEDIUM, because legitimate skills sometimes do this; the finding should ask the reviewer to check why.
  • Tests: two true positives worded differently, and one near-miss, such as documentation that explains what LD_PRELOAD is without setting it.

Sources

Before you start, read CONTRIBUTING.md, especially "Adding or changing a detection rule" and "Test samples must be safe". Comment /assign here to claim the issue.


Generated by Claude Code

Activity

  1. added
    good first issue
    new-rule
    help wanted
    on Nov 10, 2026
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

    good first issuehelp wantednew-rule

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions