-
Notifications
You must be signed in to change notification settings - Fork 1k
SECURITY: Requests module HTTPS - no server certificate verification. #838
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
Comments
The problem is, that a
With But it should be documented, that the default behavior is unsafe and the why. EDIT: Tested on a RP Pico W and it works with letsencrypt. |
Yes, you need root certificates. Some embedded platforms have root certificates built-in as part of the standard manufacturer-supplied drivers. (Example for ESP32). Ideally, MicroPython should use those, if available. In cPython, that's done with the SSLContext.load_default_certs() method. |
I used this command to convert the existing ca-bundle on my system into
It's on an Arch Linux and the resulting |
@jonfoster you may be interested in #633, see the README |
March update made request/urequest module in invalid default, because mbdetls 3.X tls 1.3 forces cert_verify required; loading entire os cacert files or disable tls 1.3 in default ssl context looks like only option |
Even if you load
To use:
|
Another solution for esp32 is to use the cert bundle and disable ability to disable the verification check. No need to change existing .py modules.
|
@mzakharocsc , what is the impact on firmware size of that change ? |
While looking at the MicroPython Requests module (on the git HEAD), I noticed this nightmare:
Assuming that it has the same meaning in MicroPython as cPython (I haven't checked), that line in the middle totally disables TLS security. The attacker pretending to be the server can send any certificate they like, and the client will blindly accept it.
If people are using HTTPS as "the new HTTP", and are happy with the HTTP you-get-no-security model, that's fine. But anyone relying on HTTPS for security, and expecting the normal level of security you'd get from HTTPS, is going to be in trouble.
At a minimum this should be documented clearly on the MicroPython requests documentation ... which doesn't seem to exist anywhere?
Ideally, MicroPython should default to a proper secure HTTPS implementation, including certificate verification, and have a way to opt-out.
The text was updated successfully, but these errors were encountered: