Skip to content

Dont trust ia32cap envvar more than cpuid 1.1.1 - #11525

Closed
bernd-edlinger wants to merge 3 commits into
openssl:OpenSSL_1_1_1-stablefrom
bernd-edlinger:dont_trust_ia32cap_envvar_more_than_cpuid_1
Closed

bernd-edlinger wants to merge 3 commits into
openssl:OpenSSL_1_1_1-stablefrom
bernd-edlinger:dont_trust_ia32cap_envvar_more_than_cpuid_1

Conversation

@bernd-edlinger

@bernd-edlinger bernd-edlinger commented Apr 12, 2020 •

Copy link
Copy Markdown
Member

This is just there to have extended CI tests in 1.1.1 run with #5860

It is WIP becasue I don't want it approved by you.

@bernd-edlinger bernd-edlinger added the branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) label Apr 12, 2020
@bernd-edlinger bernd-edlinger changed the title [WIP] Dont trust ia32cap envvar more than cpuid 1.1.1 Dont trust ia32cap envvar more than cpuid 1.1.1 Apr 15, 2020
@bernd-edlinger

Copy link
Copy Markdown
Member Author

OpenSSL> dgst -sha512 sample3.txt
SHA512(sample3.txt)= 861b6a036e3e2f79e02df261a687b04dc0a359ad36d5cb4d7c821390e43cf190c48cbfb30f98c85e6aa81d076615dec2167a5216b1bb49f798c1f8e35cb284d1
OpenSSL> dgst -sha256 sample3.txt
SHA256(sample3.txt)= eb65278bc9a2f29921c598ebb268d19844d7e6beb53699355cd9d617864bd931
OpenSSL> dgst -sha512 sample4.txt
SHA512(sample4.txt)= cbf24dd4ab1337a213b764f7a5a51c2e1fb5192f945f4ae76b870b84c29b872f8f1ce68196f2f1ab2a0e79cac59d7ff0a274253b7b5f784c3c834c09d5541ad9
OpenSSL> dgst -sha256 sample4.txt
SHA256(sample4.txt)= 31225421ae89c1abbcac87de98c31d09e7cbf4f376f9c7bc00b67ccb74b8a4de
OpenSSL> dgst -sha512 sample5.txt
SHA512(sample5.txt)= f6da079c81917a0e28e79693b7000e77a6d12e8b3aade5c67cd20aea26344954d3f4a14634c8a039c381aec45ec0c6d694254c595b1db47d907ad21b1da50555
OpenSSL> dgst -sha256 sample5.txt
SHA256(sample5.txt)= 6b10ee2e43f19ebf72ec8f9857a73ea3089cea60ebc54b66283b44d4572352ab

@paulidale paulidale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A style nit and a pair of wording suggestions. I'll need a fresher look to get my head around the detection code.

Who'd have thought CPU feature detection needed to be so (needlessly) complicated?

Comment thread crypto/ppccap.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: blank line above.

Comment thread doc/man3/OPENSSL_ia32cap.pod Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: s/, and thus cause/ causing/

Comment thread doc/man3/OPENSSL_ia32cap.pod Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the compile time option is used...

@levitte

levitte commented Apr 16, 2020

Copy link
Copy Markdown
Member

#5860 got quite a bit of push-back, to the point that you closed it... do you expect a different outcome here?

@bernd-edlinger

Copy link
Copy Markdown
Member Author

can we talk?

@bernd-edlinger

Copy link
Copy Markdown
Member Author

I only closed #5860 since a major merge conflict was imminent.

@paulidale

Copy link
Copy Markdown
Contributor

I hadn't looked at #5860 much. Thanks for the reference @levitte

I'm unsure about 1.1.1 -- this feels like a feature.

@t8m

t8m commented Apr 16, 2020

Copy link
Copy Markdown
Member

My opinion on this one is clear - I do not think it is needed in this form.

@paulidale

Copy link
Copy Markdown
Contributor

I can see the use case for freezing the settings at compile time. That makes some sense. After reading the discussions, I completely fail to understand why there is any need for masking.

An attack via an environment variable to cause a denial of service to yourself isn't justification. This would be a local mis-configuration which we shouldn't be trying to mitigate.

An attacker breaking into your system and setting such an environment variable, likewise doesn't justify this. You've got a lot more to worry about than a denial of service.

@t8m

t8m commented Apr 17, 2020

Copy link
Copy Markdown
Member

Yes, possibility to do compile-time freezing would make sense and/or completely disable the CAP envvar support as build-time option for paranoid use-cases.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

This is my proof of concept:

ed@w-ed:/tmp$ export OPENSSL_ia32cap=0:0
ed@w-ed:/tmp$ wget https://marc.info/?l=linux-kernel&m=158697302506474&q=mbox&OPENSSL_ia32cap=0xFFFFFFFFFFFFFFFF:0xFFFFFFFFFFFFFFFF
[1] 11378
[2] 11379
[3] 11380
ed@w-ed:/tmp$ --2020-04-20 07:24:11--  https://marc.info/?l=linux-kernel
Auflösen des Hostnamen »marc.info (marc.info)«... 71.33.226.59, 205.134.191.174
Verbindungsaufbau zu marc.info (marc.info)|71.33.226.59|:443... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 200 OK
Länge: nicht spezifiziert [text/html]
In »»index.html?l=linux-kernel«« speichern.

    [    <=>                                                                                    ] 101.170      160KB/s   in 0,6s   

2020-04-20 07:24:13 (160 KB/s) - »index.html?l=linux-kernel« gespeichert [101170]


[1]   Fertig                  wget https://marc.info/?l=linux-kernel
[2]-  Fertig                  m=158697302506474
[3]+  Fertig                  q=mbox
ed@w-ed:/tmp$ openssl dgst -sha256 index.html\?l\=linux-kernel 
Ungültiger Maschinenbefehl (Speicherabzug geschrieben)
ed@w-ed:/tmp$ echo $OPENSSL_ia32cap 
0xFFFFFFFFFFFFFFFF:0xFFFFFFFFFFFFFFFF
ed@w-ed:/tmp$ 

@bernd-edlinger bernd-edlinger added the severity: urgent Fixes an urgent issue (exempt from 24h grace period) label Apr 20, 2020
@bernd-edlinger

bernd-edlinger commented Apr 20, 2020 •

Copy link
Copy Markdown
Member Author

Sorry, I am unable to reach you on [email protected],

@paulidale

Copy link
Copy Markdown
Contributor

Shouldn't it be:

wget 'https://marc.info/?l=linux-kernel&m=158697302506474&q=mbox&OPENSSL_ia32cap=0xFFFFFFFFFFFFFFFF:0xFFFFFFFFFFFFFFFF'

Without the quotes, you are wgetting something and setting m, q and OPENSSL_ia32cap to values. m and q will be discarded since they are in sub-shells. The OPENSSL_ia32cap is set.

If it was your intention to not include the quotes, it is user error. We can't protect against user error.

@paulidale

Copy link
Copy Markdown
Contributor

The urgent label is for fixes to build breaking changes. I don't think it applies here.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

@paulidale you must be an NSA agent. This is the proof.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

Of course Paul Dale, is not @paulidale
Paul Dale is my friend, and he can ask Matthias who has my number.

@paulidale

Copy link
Copy Markdown
Contributor

Proof of what? That a user error causes problems for OpenSSL? That's not a surprise.

Try it with this command instead:

wget https://marc.info/?l=linux-kernel&m=158697302506474&OPENSSL_ia32cap=0xFFFFFFFFFFFFFFFF:0xFFFFFFFFFFFFFFFF&q=mbox

I've enabled shell syntax highlighting to indicate the special characters your shell is finding. Each & is acting as a command separator like ; does.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

Ordinary users don't even know what OPENSSL_ia32cap means.

That is vodoo for them, they are totally suprised by that nonsensical behavior.
Why do you think that is not a CVSS severity 9.0 bug ?

@bernd-edlinger

Copy link
Copy Markdown
Member Author

@openssl/omc please help.

@paulidale

Copy link
Copy Markdown
Contributor

The non-sensical behaviour is the shell's fault not OpenSSL's. I also don't think that ordinary users run a Unix like system and they don't run commands from the shell. Caveat emptor.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

No, that bug in the shell was also planted by agents, as this openssl bug.

@bernd-edlinger

bernd-edlinger commented Apr 20, 2020 •

Copy link
Copy Markdown
Member Author

I am pretty sure the real target is the TOR browser, which depends on OpenSSL,
I broke it already once, and Matt fixed that, while I was too sick to do it myself.
I can do it again.
DEAL?

@bernd-edlinger

Copy link
Copy Markdown
Member Author

or what do you really want?

@bernd-edlinger

Copy link
Copy Markdown
Member Author

So, decipher this, Pauli Dale. This is my last e-mail from 18.4.2020:

Hi Pauli,

On 4/17/20 6:43 AM, Dr Paul Dale wrote:
> Bernd,
>
> I didn’t find your photograph or birthday.  I didn’t spend a lot of time on it.
>
> Pauli
>

Okay, that is fine, because I had no idea if that is one of the results
that is hidden from me, when I do google from germany, but this means, that
the hidden result is not my picture or my birthday,

So they still belong to myself  and not google (no idea about facebook,
I am not on f.book, but lots of my family, but obviously they have forgotten
about me, becuase g+f=1. QED.

Now I have a another riddle for you  hope you enjoy riddles just as I do.
It is encrypted with AES, and you have the key already, I just added blabla
to the IV, I wonder if you are able to decrypt:


rFoiD81vVuipY0q3NHNF9vPnYTBAv19oVVw6kKSzJZNCz60YxvYguGuwP/t18y97
T9Y0LB8P3XXPtJX/Naywp7rFqQbMAmtlGXmdqKQ9QB1KLUSLjgk189WLaU7abDca
TVymWX01lJeV+FvuZT+Ojk4W3s/Ao6abx+W5QQALUf04agc4AdxQvnoWA1wAmfAx
aa4l5as1RBDjlAwsDF0NqiBburXf14RNM2PJMeHDALeSqoik1SI0xdwpGigaYES4
BSI+CLXZTyp02OFJq7sI3AMWmSiEWGMspR0o3BSU9Oesnec+4J08WNLQ4US2+PNU
s14+Y6CoiCQMkRuGvSrTw35de3PlYV4Yc4S/fzRiraS8AVgtiFdOazB8D0UoTp2R
S6f8+BHXvM7ROajcauq6fUiAJlsm+U2PXbpwMpYRsniywhSFR9C/IrcC4YensNbY
t9zTYfBB8AMWcTIwztq5+6wPvWi2dE6lPhsVPL7fMN1J5ixyob18F7JCwS2o6bal
IFlQ0+UgRvw9YTKPJWpimsKrmQuaul1iU5C20qaDT3zXGVCEmH3/US1Q9KMhj1yn
auKR/8fpjpr1tsLVmNRWLKUrBGRaP/O5pdWZo+gXypffXJMGcBwY7MRLf/u3ypc5
fyJOKE9TKOcTMM9tmdZuEE+MLF2caIC8zOEMsYiemx8Yv/kPiYgqmwFbMh03lQv6
1DyQGiKyXC9Ki7K0GacGwbodS5TXCH14hMQoFlaVm84kYcuHh05nzZuS4Whil90x
yPpuCRUu7DgQJME+N+52sWeYN16t+IUIHOH8N4roXajaaQnv82KAOQVP8S7KxjFm
4lxz+t+guqsojtg3h7RoS1TIyo8SKs4hHEjQderC6oXzF1KqbP+rFuj8bEI5Tk49
AIOTZPBtIhmJaoiAeGk0txqw3B3LecM7t43QCkZbzEjMmbB1gqEL7lbowkfKipXe
hfVoAbrB/LOYfgfiVuSvXYKcohoZHNY5KAShnGVVOeMLFwHMGWHEZWs8PA0K+dPZ
kgtverrIp0y24XKsxWKLWc1rkDAG+kfQ1GL0z6PKHEhDGt9PSkvSxaFGSoHN4jsS
2+wS02PAEPM82Oas8XHUf+uT9/uVHrrBKt/B32mTilSg3PDFOTrRPxNs2MA+gbMW
VDhaT+/iOB3gRyq8TByMExq6OyIa9Kurit+podHrik+ufR4DRgzkGfgEZ8sDzSNJ
BZXtt1esmSlfxntv5T/B0dStvc5sUYarA5gNvjWUDln8r3IZ3BCXItyBqr597WHV
sN/p+HgRHhKu5LNcnu8vl3Tj9bTlFt7gsIZUUSBoia7hWAZ+cTvnkcw1f2oeLEds
OrpdQDNof/Av7ZeoZh9Y7kiEiL2xaNHrTaqdsym/poCByIJE0sg1oSGWUPsQJbcv
9ugjQEyUZzFN32rewVy06iuk4Pn/Ol376wx0Kl+wZPErXyTIU8M1ArgneXzo7v6u
gnsh9RwRf/bgTzycCW7/3e0stvLqUBupN4ySggIUtRPNS4WJrKJsu6ODlxsdQUn/


If you need further hints feel free to ask 

By the way, it is not signed, I will know if you received the
unmodified cipher text if you are able to send a reply to me,
and I will only be able to decrypt it,
if there was no man in the middle attack.


See you on Tuesday,
Bernd.

@t8m

t8m commented Apr 20, 2020

Copy link
Copy Markdown
Member

Bernd, this is simply a nonsense. If you can trick an user to use wget with a random unquoted URL with a shell, you can trick him to install a root kit for example. Setting OPENSSL_ia32cap is only a single random not-that-much evil thing that you can do via such broken command from unlimited numbers of other many more much more evil examples that one could invent.

@romen

romen commented Apr 27, 2020

Copy link
Copy Markdown
Member

Reading the conversation, it seems like after the discussion we changed the target of the PR.

It seems like it could be valuable to add a build feature that allows fixing the target capabilities at build time and ship only the code supported by the fixed capabilities with the library.
The potential scenario that could most benefit from this feature is (cross-)compiling for constrained-resources targets.

Being a new feature this should be in a PR targeting master, I suggest closing this PR and opening a dedicated one with a fitting description.

(I am not excluding that we can have a vote to then backport the feature to 1.1.1, but the process should be to get it approved and merged to master and then approve its backport)

@bernd-edlinger

Copy link
Copy Markdown
Member Author

No.

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 386 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 417 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 448 days ago

@t8m t8m added the triaged: feature The issue/pr requests/adds a feature label Jul 23, 2021
@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 30 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 61 days ago

Fixes test failures with illegal values in OPENSSL_ia32cap, i.e.:
OPENSSL_ia32cap=0xFFFFFFFFFFFFFFFF:0xFFFFFFFFFFFFFFFF make test

Add a configure option -DOPENSSL_IA32CAP_OVERRIDE=x:y

Add some documentation for OPENSSL_IA32CAP_OVERRRIDE
Fixes test failures with illegal values in OPENSSL_armcap, i.e.:
OPENSSL_armcap=0xFFFFFFFF make test

Add a configure option -DOPENSSL_ARMCAP_OVERRIDE=x
Fixes test failures with illegal values in OPENSSL_ppccap, i.e.:
OPENSSL_ppccap=0xFFFFFFFF make test

Add a configure option -DOPENSSL_PPCCAP_OVERRIDE=x
@bernd-edlinger
bernd-edlinger force-pushed the dont_trust_ia32cap_envvar_more_than_cpuid_1 branch from 34c423d to acd57d2 Compare September 23, 2021 18:21
@t8m t8m added this to the Post 3.0.0 milestone Sep 24, 2021
@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 234 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 265 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 296 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 327 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 358 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 389 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 420 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 451 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 482 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 513 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 544 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 575 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 606 days ago

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 637 days ago

@t8m

t8m commented Apr 22, 2023

Copy link
Copy Markdown
Member

Closing as this is a feature - not for merging to 1.1.1.

@t8m t8m closed this Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) triaged: feature The issue/pr requests/adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.