0
Python & Cybersecurity challenge : a simple but powerful calculator... But can you find and fix the security holes ?
In 4 lines a calculator with trigonometry and possibly deep learning or any existing python package. Plus some serious security holes ! https://code.sololearn.com/cXmeQ5FUwpsQ/?ref=app
7 Answers
+ 4
Still not safe, I could do :
9);print("nop"
^^
+ 3
? :o
+ 2
If my input is :
);a_super_hacking_function();print(
Then my super hacking function will be called ^^
preventing the user from using ; and counting the parenthesis so that they are well placed (no closing one before an opening one and one closing per opening) would be a first step to fix it.
Also putting the exec function in a try except would be nice
+ 2
The parenthesis count is to prevent the user from doing :
) if false else my_super_hack_function(
0
Very good but not 100 %. You can still delete files by entering file.open('/file','w')
- 1
Here is a safe version
https://code.sololearn.com/c0zzPGplv8Yy/?ref=app
- 1
Hehe. That was the hidden challenge !