Skip to content

Add module for CVE-2021-41277 - #1393

Open
syedsuzain wants to merge 11 commits into
OWASP:masterfrom
syedsuzain:metabase_cve_2021_41277
Open

syedsuzain wants to merge 11 commits into
OWASP:masterfrom
syedsuzain:metabase_cve_2021_41277

Conversation

@syedsuzain

@syedsuzain syedsuzain commented Mar 12, 2026 •

Copy link
Copy Markdown

Proposed change

CVE-2021-41277 is a critical vulnerability in Metabase, an open-source data analytics platform. The /api/geojson endpoint 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 a file:// 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

Screenshot_20260313_072250

Type of change

  • New core framework functionality
  • Bugfix (non-breaking change which fixes an issue)
  • Code refactoring without any functionality changes
  • New or existing module/payload change
  • Documentation/localization improvement
  • Test coverage improvement
  • Dependency upgrade
  • Other improvement (best practice, cleanup, optimization, etc)

Checklist

  • I've followed the contributing guidelines
  • I have digitally signed all my commits in this PR
  • I've run make pre-commit and confirm it didn't generate any warnings/changes
  • I've run make test, I confirm all tests passed locally
  • I've added/updated any relevant documentation in the docs/ folder
  • I've linked this PR with an open issue
  • I've tested and verified that my code works as intended and resolves the issue as described
  • I have attached screenshots demonstrating my code works as intended
  • I've checked all other open PRs to avoid submitting duplicate work
  • I confirm that the code and comments in this PR are not direct unreviewed outputs of AI
  • I confirm that I am the Sole Responsible Author for every line of code, comment, and design decision

Copilot AI review requested due to automatic review settings March 12, 2026 09:54
@coderabbitai

coderabbitai Bot commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds 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 /api/geojson?url=... using file:// URIs, port/scheme permutations, and response regexes to detect LFI.

Changes

Cohort / File(s) Summary
Documentation
docs/Modules.md
Inserted metabase_cve_2021_41277 entry into the Vulnerability Modules list.
Vulnerability Module Definition
nettacker/modules/vuln/metabase_cve_2021_41277.yaml
New YAML vuln module: metadata (name, author, severity, refs, profiles); HTTP GET payload targeting /api/geojson?url=<fuzzer>; fuzzer includes file:///etc/passwd and file:///c:/windows/win.ini; iterates common ports and http/https; requires HTTP 200 and response regexes for LFI detection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

new module

Suggested reviewers

  • arkid15r
🚥 Pre-merge checks | ✅ 5

✅ Passed checks (5 passed)

Check name Status Explanation
Title check ✅ Passed The title 'Add module for CVE-2021-41277' directly and clearly describes the main change—adding a vulnerability module for the specified CVE.
Description check ✅ Passed The description comprehensively documents the CVE vulnerability, testing evidence on both vulnerable and patched versions, and confirms the author's work and assertions.
Linked Issues check ✅ Passed The PR fully implements all coding objectives from issue #1390: adds the metabase_cve_2021_41277.yaml module targeting /api/geojson endpoint with file:// URI LFI detection, tested on vulnerable v0.40.3 and patched v0.40.5 versions.
Out of Scope Changes check ✅ Passed All changes are scoped to the CVE-2021-41277 module: the YAML definition file and corresponding documentation entry in Modules.md are directly related to the linked issue objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Finishing Touches

🧪 Generate unit tests (beta)

  • Create PR with unit tests
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_vuln YAML module that probes /api/geojson with file:// payloads and matches responses.
  • Updated docs/Modules.md to 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.

Comment thread docs/Modules.md Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 58ac7f9 and c06a1ee.

📒 Files selected for processing (2)
  • docs/Modules.md
  • nettacker/modules/vuln/metabase_cve_2021_41277.yaml

Comment thread docs/Modules.md Resolved
@syedsuzain
syedsuzain marked this pull request as draft March 12, 2026 10:10
@syedsuzain
syedsuzain force-pushed the metabase_cve_2021_41277 branch from c06a1ee to 06edc18 Compare March 12, 2026 10:25

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
nettacker/modules/vuln/metabase_cve_2021_41277.yaml (2)

42-50: ⚠️ Potential issue | 🔴 Critical

Require both a 200 and file-read evidence.

condition_type: or lets a bare 200 response report as vulnerable, even when the body does not contain /etc/passwd or win.ini content. 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 | 🔴 Critical

Use single-brace placeholders in input_format.

Line 26 is rendered via input_format.format(**formatted_data) when interceptors is empty. {{schema}}, {{ports}}, and {{lfi_paths}} are escaped literals, so the module never sends a real file:// 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",
))
PY

Expected 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

📥 Commits

Reviewing files that changed from the base of the PR and between c06a1ee and 06edc18.

📒 Files selected for processing (2)
  • docs/Modules.md
  • nettacker/modules/vuln/metabase_cve_2021_41277.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/Modules.md

@syedsuzain
syedsuzain marked this pull request as ready for review March 12, 2026 10:44
@Aarush289

Aarush289 commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor

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 )

@syedsuzain

Copy link
Copy Markdown
Author

Hi @syedsuzain the syntax in Nettacker-fuzzer input format is wrong and the module is crashing , I am very much inerested 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.

@Aarush289

Aarush289 commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

LGTM ! , I have tested the module on a vulnerable instance which got detected due to regex match ( root:(\s+): ) .

@syedsuzain
syedsuzain force-pushed the metabase_cve_2021_41277 branch from ac1185a to 3d0b332 Compare March 18, 2026 05:53
@syedsuzain
syedsuzain requested a review from securestep9 March 19, 2026 02:43
- http
- critical_severity
- metabase
- lfi

@securestep9 securestep9 Mar 28, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@syedsuzain please add cisa_kev profile here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@securestep9 Do I need to make any more changes?

@syedsuzain
syedsuzain force-pushed the metabase_cve_2021_41277 branch from fd53553 to 3d0b332 Compare March 29, 2026 15:56
@syedsuzain
syedsuzain requested a review from securestep9 March 30, 2026 04:36
@securestep9 securestep9 added the new module pull request with new module(s) label Apr 19, 2026
@syedsuzain

Copy link
Copy Markdown
Author

@securestep9 Why hasn't the module been merged into the nettacker modules yet?

syedsuzain and others added 5 commits October 20, 2026 14:02
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>
@syedsuzain
syedsuzain force-pushed the metabase_cve_2021_41277 branch from 0436ffa to 20f2c5b Compare October 20, 2026 08:33
@github-actions

Copy link
Copy Markdown

Contribution validation failed:

  • issue_assignee: The linked issue must be assigned to the PR author before this PR can be merged.

@github-actions github-actions Bot closed this Oct 20, 2026
@securestep9 securestep9 reopened this Oct 22, 2026
@securestep9

Copy link
Copy Markdown
Collaborator

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T21:19:51.330902Z e1fcd9e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: e1fcd9e3d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@securestep9 securestep9 added this to the v0.4.2 milestone Nov 12, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs unit tests new module pull request with new module(s)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Metabase Local File Inclusion - CVE-2021-41277 (CISA KEV)

4 participants