Skip to content

Conversation

fproulx-boostsecurity
Copy link
Contributor

@fproulx-boostsecurity fproulx-boostsecurity commented Oct 17, 2025

This pull request introduces a new framework and command for qualifying "Living Off The Pipeline" (LOTP) gadgets in CI/CD security analysis. The main changes include a comprehensive definition of LOTP concepts and attack chains in GEMINI.md, and the addition of a new .gemini command for interactive LOTP qualification. These changes provide a structured approach for identifying and classifying pipeline tools and gadgets based on their potential for abuse by attackers.

Framework and Definitions for LOTP Analysis:

  • Added a detailed section to GEMINI.md that defines First-Order and Second-Order LOTP, including clear criteria for identifying malicious primitives (RCE, file read/write, network access, environment variable manipulation) and the importance of verifying the usefulness of those primitives. The documentation also covers the impact of sandboxing and configuration file control on tool security.

Interactive LOTP Qualification Command:

  • Introduced .gemini/commands/qualify_lotp.toml, a new command for qualifying a tool as a LOTP gadget. This command guides users through the analysis process, referencing the framework in GEMINI.md, and includes instructions for consulting the knowledge base, analyzing primitives, and determining gadget roles in attack chains.

These changes establish a standardized process for evaluating tools within CI/CD pipelines for LOTP risks and enable security experts to document and reason about gadget chains more effectively.

$ gemini # Start Gemini CLI
# Type /qualify_lotp hugo, sit back and get new LOTPs 🥇 

demo

Comment on lines +45 to +46
* If it is a Gadget, discuss its potential role as a "Setup" or "Execution" gadget in a Second-Order attack chain.
* Reference specific examples or official documentation for the tool to support your conclusion.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this one. Do we want to describe potential use in Second-Order for a First-Order tool? It seems like noise, since the second-order are defined in the tools which provide second-order vector already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's kind of confusing.

My idea was it's First-Order if you get a foot-hold (some major or minor) advantage as "Initial Access". Like a First-Order Tool gives you RCE with a sniper shot, while First-Order Gadget gives you something which is constrained, but can be useful to reach a Second-Order Tool in a way. Typically that's gonna be those needing an env var.

* *Examples:* An XML processor that resolves external entities (`XXE`), a template engine that can include local files.
* **Arbitrary Network Access:** The ability to make network requests to arbitrary endpoints. This is often used for data exfiltration.
* *Examples:* A tool with a templating feature that can perform DNS lookups or HTTP requests, an XSLT processor using the `document()` function to fetch a remote DTD or stylesheet.
* **Environment Variable Manipulation:** The ability to set or modify environment variables for subsequent steps in the pipeline. This is a classic "Setup" primitive.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add environment variable read primitive?

Copy link
Contributor Author

@fproulx-boostsecurity fproulx-boostsecurity Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, like it was for Trivy. Reading an env var is not enough, unless you have a way to exfil (via logs or network)

1. **The "Setup" Gadget:** A First-Order LOTP that provides a non-RCE primitive, such as writing a file, reading a secret, or setting an environment variable.
2. **The "Execution" Gadget:** A subsequent tool in the pipeline that is triggered by the change made by the setup gadget, leading to full RCE.

A prime example involves `bash` in GitHub Actions. A "setup" gadget (any First-Order LOTP with a file write primitive) could write `BASH_ENV=./attacker-script.sh` to the file at `$GITHUB_ENV`. The "execution" gadget would be `bash` itself in a later `run` step, which would then execute the script because the `BASH_ENV` variable causes `bash` to source the specified script upon startup. For more details on this mechanism, see: [`_tool/bash.md`](_tool/bash.md).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it is the best example, since $GITHUB_ENV is a uuid named file, we need to have access to environment variable read to modify this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but if I recall at any one time there is a single GITHUB_ENV file or even if many , if you can use * globbing we could affect it without knowing the exact file name, but I agree this has some extra contraints , vs another more static file


A prime example involves `bash` in GitHub Actions. A "setup" gadget (any First-Order LOTP with a file write primitive) could write `BASH_ENV=./attacker-script.sh` to the file at `$GITHUB_ENV`. The "execution" gadget would be `bash` itself in a later `run` step, which would then execute the script because the `BASH_ENV` variable causes `bash` to source the specified script upon startup. For more details on this mechanism, see: [`_tool/bash.md`](_tool/bash.md).

It is crucial to understand that while many potential "setup" gadgets exist, they only become exploitable vulnerabilities if a corresponding "execution" gadget exists later in the *same pipeline workflow* to complete the chain.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it is going to discard LOTP based on this which is workflow dependent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in terms of the LLM reasoning it should not get stuck on "ame pipeline workflow" too much, more like a rhetorical "imagine a workflow"

fproulx-boostsecurity and others added 2 commits October 20, 2025 10:32
Co-authored-by: Sébastien Graveline <[email protected]>
Signed-off-by: François Proulx <[email protected]>
Co-authored-by: Sébastien Graveline <[email protected]>
Signed-off-by: François Proulx <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants