Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocols are not filtered in tornado.curl_httpclient #1771

Closed
stiletto opened this issue Jul 19, 2016 · 1 comment
Closed

Protocols are not filtered in tornado.curl_httpclient #1771

stiletto opened this issue Jul 19, 2016 · 1 comment

Comments

@stiletto
Copy link
Contributor

Tornado should set pycurl.PROTOCOLS option to pycurl.PROTO_HTTP|pycurl.PROTO_HTTPS.
There are many real-world applications using tornado HTTP client to fetch data from user-provided URLs.
Tornado doesn't filter protocols in provided URLs making it possible to abuse its HTTP client like this:

#!/usr/bin/env python3
# coding: utf-8
import tornado.ioloop, tornado.gen, tornado.httpclient, tornado.curl_httpclient

@tornado.gen.coroutine
def main():
    tornado.httpclient.AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient")
    for url in ('file:///etc/passwd','telnet://time-c.nist.gov:13'):
        res = yield tornado.httpclient.AsyncHTTPClient().fetch(url, raise_error=False)
        print(res.body.decode('utf-8','replace'))

if __name__ == "__main__":
    main().add_done_callback(lambda x: tornado.ioloop.IOLoop.current().stop())
    tornado.ioloop.IOLoop.current().start()
@Brevin-yoke
Copy link

Tornado also should set pycurl.M_MAXCONNECTS option, that can reduce TCP TIME_WAIT efficacious

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants