]> git.proxmox.com Git - proxmox-acme.git/commit
acme client: fix #3536 untaint data returned from acme server
authorStoiko Ivanov <s.ivanov@proxmox.com>
Fri, 6 Aug 2021 15:44:27 +0000 (17:44 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 11 Aug 2021 09:52:53 +0000 (11:52 +0200)
commita5320155c19a9ce8a0cf1e3802705ae05884ef2f
tree671f1c0b7161a98ede164b9a4fe014aef91baed3
parentcd3891a7121dc99824c98eeae597b5d7fc230b18
acme client: fix #3536 untaint data returned from acme server

The data returned from the acme server (e.g. boulder) should be
considered tainted.

To see which places might need untainted I checked where $self->{ua}
was used (in $self->do) and a quick scan identified __get_result as
the consumer of the tainted data.
In all but one uses the data is decoded from json (which would die if the
result is not valid json).

The remaining use-case yields a certificate in PEM format (and is
handled at the caller of __get_result).

The issue is currently only visible if a proxy is set, because AFAICT
somewhere in SSLeay (or IO::Socket::SSL, which uses SSLeay) a taint
flag is not set on the return value.

A reproducer for the issue:
```

use strict;
use warnings;

use HTTP::Request;
use LWP::UserAgent;

$ENV{PATH} = "/usr/bin:/bin";

my $ua = LWP::UserAgent->new(env_proxy => 0);
my $request = HTTP::Request->new('GET', 'https://google.com/');
my $resp = $ua->request($request);
my $text = substr($resp->decoded_content, 0, 5);;
system("echo \"$text\""); # does work
$request = HTTP::Request->new('GET', 'http://neverssl.com/');
$resp = $ua->request($request);
$text = substr($resp->decoded_content, 0, 5);;
system("echo \"$text\""); # does not work
```

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PVE/ACME.pm