> For the complete documentation index, see [llms.txt](https://alham-rizvi.gitbook.io/alhamrizvi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alham-rizvi.gitbook.io/alhamrizvi/bug-bounty-methodology/cmdi.md).

# CMD Injection

**Requirement:** `parameter.txt` must exist (combined output from ParamSpider / Arjun / FFUF).

The goal here is to **reduce noise**, scan safely, and test CMD injection in **controlled chunks of 100 URLs**.

```bash
# Step 1: Filter parameters that commonly lead to command injection
# This avoids scanning every parameter blindly
grep -Ei "ip|host|ping|cmd|exec|shell|run|query" parameter.txt > cmdi_all.txt

# Step 2: Remove duplicate URLs to reduce scan time
sort -u cmdi_all.txt > cmdi_unique.txt

# Step 3: Keep only valid parameterized URLs (must contain '=')
grep "=" cmdi_unique.txt > cmdi_final.txt

# Step 4: Split into chunks of 100 URLs per file
# Example output files: cmdi_aa, cmdi_ab, cmdi_ac ...
split -l 100 cmdi_final.txt cmdi_

# Step 5: Safe initial detection scan (fast, low noise)
commix -m /home/alhamr/Downloads/bmw/results/cmdi_aa --batch --level=1

# Step 6: Deeper confirmation scan on the same 100 URLs
commix -m /home/alhamr/Downloads/bmw/results/cmdi_aa --batch --level=2

# Step 7: Blind / time-based CMD injection testing (slow, last option)
commix -m /home/alhamr/Downloads/bmw/results/cmdi_aa --batch --level=3 --technique=t

# Step 8: Move to the next 100 URLs and repeat from level 1
commix -m /home/alhamr/Downloads/bmw/results/cmdi_ab --batch --level=1

# Step 9: Save detailed results for reporting and later review
commix -m /home/alhamr/Downloads/bmw/results/cmdi_aa --batch --level=2 --output-dir=commix_results
```

**Recommended flow:** `level=1 → level=2 → level=3 (only if needed)`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://alham-rizvi.gitbook.io/alhamrizvi/bug-bounty-methodology/cmdi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
