feat: add diagnostic command injection challenge to mechanic service#371
Open
gabrielfrdev wants to merge 2 commits intoOWASP:developfrom
Open
feat: add diagnostic command injection challenge to mechanic service#371gabrielfrdev wants to merge 2 commits intoOWASP:developfrom
gabrielfrdev wants to merge 2 commits intoOWASP:developfrom
Conversation
piyushroshan
reviewed
May 7, 2026
| "sent": True, | ||
| "report_link": report_link, | ||
| } | ||
| diagnostic_command = report_details.get("diagnostic_command") |
Collaborator
There was a problem hiding this comment.
RCE should be only enabled when the ENABLE_SHELL_INJECTION env is injected. So its safe when users deploy with public access which should be default behavior
Author
There was a problem hiding this comment.
Thanks for the review. I pushed an update that gates the diagnostic shell execution behind ENABLE_SHELL_INJECTION, with the default set to false for public deployments.
I also wired the flag into the Workshop deployment config, added coverage for the default-disabled and enabled challenge paths, and updated the docs/OpenAPI to make the lab-only behavior explicit.
Validated locally with the Workshop test suite and the full Postman/Newman collection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new Direct Command Injection challenge to the workshop mechanic service.
The goal is to demonstrate how unsafe handling of shell commands—specifically using
subprocess.runwithshell=Trueon user-controlled input—leads to Remote Code Execution (RCE). Users can now exploit thediagnostic_commandparameter in theReceiveReportViewto execute arbitrary commands on the host.Testing
services/workshop/crapi/mechanic/tests.pyandservices/workshop/crapi/merchant/tests.pyto verify:;).diagnostic_command=status; ls -laand confirming the host's directory listing in the response.Documentation
openapi-spec/crapi-openapi-spec.jsonto include the new parameter and response fields.docs/challenges.mdanddocs/challengeSolutions.mdto include instructions and the solution for this new challenge.Checklist: