Let's say there is a program sending some data to server via GET:
http://server.com/gateway?value1=abc&value3=def
Then the server sends these values further, adding value2: (python code)
SECURED_VALUE = "safe"
"http://externalAPI.com/?value1={0}&value2={1}&value3={2}".format ( get['value1'], SECURED_VALUE, get['value2'] )
And my point is, can I inject another attribute to the latter request in a way like:
http://server.com/gateway?value1=abc&&value2=hacked&value3=def&&value2=hacked
so then the server --> API request looks like:
http://externalAPI.com/?value1=abc&value2=hacked&value2=safe&value3=def&value2=hacked
The external API most probably will read only the last or first occurrence of the repeated key.
So I have two questions, main, if such hack is possible and one should protect his apps against it. Secondary, how to actually do that, not only by GET method, but maybe by POST, or by modifying a JSON encoded string. Decoding JSON with an ampersand or semicolon gives me an error, putting ampersand to POST method behaves same as in GET method.
I ask this, because I found some security issue and I'm currently writing an example of a successful hacking attempt in case a server developer doesn't strip out ampersands and other risky characters. I don't want to turn out to be a stupid guy who doesn't know such injection can't be performed and is only wasting time of admins, so I thought I'll ask You first.
Third, mini-question, do you know of any good sources of wisdom how to protect yourself from injection (what functions to use for that) in Google App Engine, python, webapp2 framework?