Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote Code Execution in convert CI/CD stage through PYTHON_ARGS environment variable #12

Open
gronke opened this issue Jul 26, 2024 · 0 comments

Comments

@gronke
Copy link
Contributor

gronke commented Jul 26, 2024

An insecure PYTHON_ARGS environment variable in the CI/CD runners allows members of a repository with permission to manually trigger a pipeline

Technical Description

When the disable_entrypoint_overwrite setting was enabled (https://docs.gitlab.com/runner/configuration/advanced-configuration.html), preventing committers from overriding the entrypoint of the convert image. The entrypoint assumes a users ability to execute arbitrary commands on the runner instance, hence including insecure PYTHON_ARGS exposed no further risk.

Steps to reproduce

  1. Create pentext project (with source/report.xml existing)
  2. Commit malicious Python script to the repository (touch ./source/my-evil-script.py)
  3. Manually run the CI/CD pipelines with PYTHON_ARGS=./source/my-evil-script.py

Impact

Repository members with permission to manually run a convert pipeline execute arbitrary Python code on the GitLab Runner instance, allowing to circumvent the intended security measure

Recommendation

  • With entrypoint override disabled, do not include PYTHON_ARGS.
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

No branches or pull requests

1 participant