Skip to content
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

get_idp_cert() erroneously returns wrong private key from data.mdb #6

Open
i128 opened this issue Dec 30, 2021 · 2 comments · May be fixed by #16
Open

get_idp_cert() erroneously returns wrong private key from data.mdb #6

i128 opened this issue Dec 30, 2021 · 2 comments · May be fixed by #16

Comments

@i128
Copy link

i128 commented Dec 30, 2021

For VMware vSphere 6.7.0.4600, the get_idp_cert() function returns the first instance of bytes found that it thinks are a private key. I do see you perform a check_key_valid() to check if its a true cert or not. But unfortunately, these false positives pass the check.

Consequently, the private key is invalid and the SAML assertion can not be signed.

image

A quick fix to address the issue was comment out like 135 (which returns the key) and instead write all possible keys to separate files.

image

then with each key, i ran openssl rsa -noout -text -in $keyname to check if the key was valid or not. Out of the 100+ possible private keys extracted by get_idp_cert() one eventually was found to be correct. This key was then manually fed into sign_assertion()

image

Im sure there's a better way to address this. But it was the fix that worked for me at the time.

@scopedsecurity
Copy link
Contributor

scopedsecurity commented Dec 31, 2021

Hey, really appreciate the detailed issue. I'll have to think some about a solution - my gut instinct is that I can improve the IdP certificate locating logic and also do some real certificate validation beyond just checking the first few bytes.

In your case, were all the false positives real certificates or did they just happen to pass the rough checks I had in place?

@i128
Copy link
Author

i128 commented Jan 14, 2022

Sorry for the late response.

In my case, all of the false positives were NOT certificates. At least not valid to the point where openssl could read them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants