Last active
April 3, 2024 01:36
-
-
Save mcsee/234f3b1d3a82bfc9bba82d8bb0af642c to your computer and use it in GitHub Desktop.
This file contains 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
def calculate(mathOperand, firstArgument, secondArgument): | |
return eval(f'{firstArgument} {mathOperand} {secondArgument}') | |
# Sample usage to multiply two numbers | |
result = calculate('*', 4, 6) | |
# Injection to remove all files | |
calculate('', "__import__('os').system('rm -rf *')",'')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment