Skip to content

Not erasing secrets from heap/stack after use #7268

@piru

Description

@piru

In number of locations libcurl omits zeroing memory after it has been used to store a copy of a clear text password or derived key material. This doesn't have a direct security impact in normal circumstances, but may become one if application using libcurl has some flaw that allows heap or stack disclosure. One historical example of such issue is the infamous openssl heartbleed vulnerability.

I did this

  1. asked user for a password
  2. passed the password to libcurl
  3. afterwards securely memset_s the password to all 0
  4. dumped process memory
  5. looked for the password in memory and found copy of it

I expected the following

libcurl itself to wipe the passwords / key material after use.

curl/libcurl version

curl 7.77.1-DEV (x86_64-pc-linux-gnu) libcurl/7.77.1-DEV OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.4.57
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Largefile libz NTLM NTLM_WB PSL SSL TLS-SRP UnixSockets

operating system

Linux hostname 5.10.0-6-amd64 #1 SMP Debian 5.10.28-1 (2021-04-09) x86_64 GNU/Linux

references

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions