Repository navigation
Add module for CVE-2021-41277 - #1393
syedsuzain wants to merge 11 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a new vulnerability module for Metabase CVE-2021-41277 (unauthenticated LFI) and registers it in the modules documentation. The YAML defines an HTTP GET payload against Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5
Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
Pull request overview
Adds a new OWASP Nettacker vulnerability module to detect Metabase CVE-2021-41277 (unauthenticated LFI via /api/geojson?url=), and documents it in the module list.
Changes:
- Added
metabase_cve_2021_41277_vulnYAML module that probes/api/geojsonwithfile://payloads and matches responses. - Updated
docs/Modules.mdto include the new Metabase module in the vulnerability modules list.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
nettacker/modules/vuln/metabase_cve_2021_41277.yaml |
New vuln module definition for Metabase CVE-2021-41277 LFI detection. |
docs/Modules.md |
Adds a new bullet entry for the Metabase CVE-2021-41277 module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/Modules.md`:
- Line 217: The docs entry uses the module identifier metabase_cve_2021_41277
but the module YAML declares info.name: metabase_cve_2021_41277_vuln, so update
the documentation entry to use the exact YAML identifier
(metabase_cve_2021_41277_vuln) to keep names in sync; alternatively, if you
prefer the shorter name, change the YAML info.name to
metabase_cve_2021_41277—ensure both the docs entry and the YAML info.name match
the chosen identifier.
In `@nettacker/modules/vuln/metabase_cve_2021_41277.yaml`:
- Around line 42-50: The rule currently uses condition_type: or so a bare 200
status triggers a vuln; change the response block in
metabase_cve_2021_41277.yaml so both status and evidence in the body must match
by setting condition_type: and (and optionally tighten the status_code regex to
'^200$'); ensure the response.conditions entries (status_code and content with
their regexes) remain unchanged so detection requires both a 200 and the
file-read/content pattern.
- Around line 24-40: The input_format in the nettacker_fuzzer block uses escaped
double braces (e.g., "{{schema}}", "{{ports}}", "{{lfi_paths}}") which prevents
Python's str.format from substituting values; update input_format to use single
braces (e.g., "{schema}://{target}:{ports}/api/geojson?url={lfi_paths}") so
format(**formatted_data) in nettacker/core/utils/common.py will correctly
substitute values and the file:// LFI probe will be sent; keep the same field
names (input_format, nettacker_fuzzer, lfi_paths) so the rest of the code
continues to reference them correctly.
- Around line 1-5: The commit containing the change to the YAML entry named
metabase_cve_2021_41277_vuln is unsigned; sign the commits before merging by
either signing the last commit with git commit -S --amend --no-edit && git push
--force-with-lease, or if there are older unsigned commits perform an
interactive rebase and sign commits (git rebase -i --autosquash / edit each
commit and git commit -S --amend) then force-push; ensure your GPG key is
configured and verified in your GitHub account so the pre-merge checks pass.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 87417b7f-573b-4db4-87cd-8835ceed4ca6
📒 Files selected for processing (2)
docs/Modules.mdnettacker/modules/vuln/metabase_cve_2021_41277.yaml
c06a1ee to
06edc18
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (2)
nettacker/modules/vuln/metabase_cve_2021_41277.yaml (2)
42-50:⚠️ Potential issue | 🔴 CriticalRequire both a 200 and file-read evidence.
condition_type: orlets a bare 200 response report as vulnerable, even when the body does not contain/etc/passwdorwin.inicontent. That will false-positive on reachable but patched Metabase instances.Proposed fix
- condition_type: or + condition_type: and conditions: status_code: - regex: '200' + regex: '^200$' reverse: false content: regex: "root:(\\S+):|\\[extensions\\]" reverse: false🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@nettacker/modules/vuln/metabase_cve_2021_41277.yaml` around lines 42 - 50, The response matching currently uses condition_type: or which reports vulnerabilities on any 200 status even without file-read evidence; update the response block to require both checks by changing condition_type from "or" to "and" so that both conditions.status_code (regex '200') and conditions.content (regex "root:(\\S+):|\\[extensions\\]") must match; verify the status_code and content entries remain under response.conditions so the vulnerability is only flagged when a 200 response contains the file-read evidence.
25-26:⚠️ Potential issue | 🔴 CriticalUse single-brace placeholders in
input_format.Line 26 is rendered via
input_format.format(**formatted_data)wheninterceptorsis empty.{{schema}},{{ports}}, and{{lfi_paths}}are escaped literals, so the module never sends a realfile://probe.Proposed fix
- input_format: "{{schema}}://{target}:{{ports}}/api/geojson?url={{lfi_paths}}" + input_format: "{schema}://{target}:{ports}/api/geojson?url={lfi_paths}"#!/bin/bash python - <<'PY' fmt = "{{schema}}://{target}:{{ports}}/api/geojson?url={{lfi_paths}}" print(fmt.format( schema="http", target="example.com", ports=3000, lfi_paths="file:///etc/passwd", )) PYExpected result if the bug is present:
{schema}://example.com:{ports}/api/geojson?url={lfi_paths}.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@nettacker/modules/vuln/metabase_cve_2021_41277.yaml` around lines 25 - 26, The input_format in the nettacker_fuzzer currently uses double-braced escaped placeholders ("{{schema}}", "{{ports}}", "{{lfi_paths}}") so .format(**formatted_data) never substitutes them; update input_format to use single-brace placeholders for schema and ports and lfi_paths (i.e., {schema}, {ports}, {lfi_paths}) while keeping {target} as-is so the call in the rendering path (input_format.format(**formatted_data) when interceptors is empty) produces real URLs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@nettacker/modules/vuln/metabase_cve_2021_41277.yaml`:
- Around line 42-50: The response matching currently uses condition_type: or
which reports vulnerabilities on any 200 status even without file-read evidence;
update the response block to require both checks by changing condition_type from
"or" to "and" so that both conditions.status_code (regex '200') and
conditions.content (regex "root:(\\S+):|\\[extensions\\]") must match; verify
the status_code and content entries remain under response.conditions so the
vulnerability is only flagged when a 200 response contains the file-read
evidence.
- Around line 25-26: The input_format in the nettacker_fuzzer currently uses
double-braced escaped placeholders ("{{schema}}", "{{ports}}", "{{lfi_paths}}")
so .format(**formatted_data) never substitutes them; update input_format to use
single-brace placeholders for schema and ports and lfi_paths (i.e., {schema},
{ports}, {lfi_paths}) while keeping {target} as-is so the call in the rendering
path (input_format.format(**formatted_data) when interceptors is empty) produces
real URLs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 65150715-ae65-4184-bbb7-610a70533362
📒 Files selected for processing (2)
docs/Modules.mdnettacker/modules/vuln/metabase_cve_2021_41277.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/Modules.md
|
Hi @syedsuzain the syntax in Nettacker-fuzzer input format is wrong and the module is crashing , I am very much interested to know, how did you get the successful detection ? ( I have tested the module by running it myself to confirm that it is crashing ) |
@Aarush289 Thanks for pointing that out, actually I made some changes as coderabbit showed some errors with the syntax, so made some modifications that's when it started to fall apart. I've tested the module again locally and it loads and runs without crashing now. The fix has been pushed in the latest commit. Please let me know if you notice anything else that should be improved. |
|
LGTM ! , I have tested the module on a vulnerable instance which got detected due to regex match ( root:(\s+): ) . |
ac1185a to
3d0b332
Compare
| - http | ||
| - critical_severity | ||
| - metabase | ||
| - lfi |
fd53553 to
3d0b332
Compare
|
@securestep9 Why hasn't the module been merged into the nettacker modules yet? |
Signed-off-by: Syed Suzain <syedsuzain@duck.com>
Signed-off-by: Syed Suzain <103878899+syedsuzain@users.noreply.github.com>
Signed-off-by: Syed Suzain <103878899+syedsuzain@users.noreply.github.com>
0436ffa to
20f2c5b
Compare
|
Contribution validation failed:
|
|
@codex review this PR using skill: https://github.com/nettacker-codex-ai/skills/blob/main/pr-review-recommender/SKILL.md |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Proposed change
CVE-2021-41277 is a critical vulnerability in Metabase, an open-source data analytics platform. The
/api/geojsonendpoint accepts a url parameter to load custom GeoJSON map data and passes it directly to the server's file-fetching logic without any scheme validation or path sanitization. By supplying afile:// URI, an unauthenticated attacker can read arbitrary files from the server filesystem in a single GET request, including environment variables and credentials. The vulnerability is listed in CISA's Known Exploited Vulnerabilities catalog.Closes #1390
Type of change
Checklist
make pre-commitand confirm it didn't generate any warnings/changesmake test, I confirm all tests passed locallydocs/folder