-
Notifications
You must be signed in to change notification settings - Fork 383
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
Upload dockerd socket mount detection rule and test file #3360
base: develop
Are you sure you want to change the base?
Conversation
|
thanks for the contribution! can you add a positive and negative test case annotation to the code? cf https://semgrep.dev/docs/writing-rules/testing-rules/ |
Done :) |
This looks good to me, thanks for the contribution! |
Hey @0xDC0DE, can we merge? |
Update the rule for checking if FEATURE_SECURE_PROCESSING is set to TRUE for DocumentBuilderFactory object.
java/lang/security/audit/xxe/documentbuilderfactory-disallow-doctype-decl-missing.yaml
Outdated
Show resolved
Hide resolved
…aml" This reverts commit c1e2281.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR adds a new rule, along with a test file, for dockerd unix socket file i.e.
docker.sock
mount detection.Description
Docker works in client-server architecture. In a normal setup,
docker
command issued in the CLI interacts with the docker server(dockerd
) using a Remote API or Unix Socket File(docker.sock
) - the latter is often encountered. However, in a scenario where an attacker breaks into the container that has/var/run/docker.sock
mounted, it can be leveraged to execute arbitrary commands on the host machine i.e. to talk back to the host machine thereby providing a way for escaping the container.Example
Here's a dummy Dockerfile that mounts docker.sock file:
Upon running Semgrep with the provided rule, this is how the output looks like:
![image](https://private-user-images.githubusercontent.com/38760238/324064983-b90ffa01-a42d-4103-a39c-feac59a75882.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzNDk5MDUsIm5iZiI6MTcyMTM0OTYwNSwicGF0aCI6Ii8zODc2MDIzOC8zMjQwNjQ5ODMtYjkwZmZhMDEtYTQyZC00MTAzLWEzOWMtZmVhYzU5YTc1ODgyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE5VDAwNDAwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg4YmM5ZmM0ZmFhYzcxYzY3NTM3M2Q3M2IwZDU3NzQzNjkyYmE4M2E0ZjhjNzI4MjljZGQ2MDY2NDJkZGQ0YzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Q8rYaN02iYXtFdl0F1gdeRm95QCVt8rJxY4nbtygXRU)
Thanks.