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

Make blocklist use substrings instead of direct equality, other patches. #76

Merged
merged 3 commits into from
Jan 11, 2024

Conversation

quasar098
Copy link
Contributor

Add __repr__ for debugging purposes for OperatorIssueDetails

Block __import__ for builtins, all imports should be done through INST/GLOBAL/STACK_GLOBAL anyways

Fixed string (should be list) where "operator": "attrgetter" in blocklist

Blocked pty module (pty.spawn('/bin/sh'))

Blocked pickle module (pickle.loads(bad_pickle))

Revamp the filtering so that instead of a direct comparison between used attribute name and blocked attribute, we use substrings to successfully block eval.__call__, for example, which was not previously blocked

Add malicious12 test case which uses pickle.loads(malicious_pkl)

Add malicious13 test case which uses builtins-eval.__call__ to bypass previous blocklist functionality

@seanpmorgan seanpmorgan self-assigned this Jan 10, 2024
Copy link
Member

@seanpmorgan seanpmorgan left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you very much for the improvements @quasar098!

@seanpmorgan seanpmorgan merged commit ad92b37 into protectai:main Jan 11, 2024
@quasar098 quasar098 deleted the patch-1 branch January 13, 2024 03:17
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.

2 participants