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

CPP: PAM Authorization Bypass #8775

Merged
merged 2 commits into from Apr 29, 2022
Merged

CPP: PAM Authorization Bypass #8775

merged 2 commits into from Apr 29, 2022

Conversation

Copy link
Contributor

@porcupineyhairs porcupineyhairs commented Apr 19, 2022

This PR is similar to my other PRs for
Python and
Golang.

This PR aims to detect instances were an initiated PAM Transaction invokes the pam_authenticate method but does not call the pam_acct_mgmt method. This is bad as a call to pam_authenticate only verifies the users credentials. It does not check if the user account is still is a valid state.

If only a call to pam_authenticate is used to verify the user, a user with an expired account password would still be able to login. This can be prevented by calling the pam_acct_mgmt function after a pam_authenticate function.

This PR is similar to my other PRs for
[Python](github#8595) and
[Golang](github/codeql-go#709).

This PR aims to detect instances were an initiated PAM Transaction invokes the `pam_authenticate` method but does not invoke a call to the pam_acct_mgmt` method. This is bad as a call to `pam_authenticate` only verifies the users credentials. It does not check if the user account is still is a valid state.

If only a call to `pam_authenticate` is used to verify the user, a user with an expired account password would still be able to login. This can be prevented by calling the `pam_acct_mgmt` function after a `pam_authenticate` function.
Copy link
Contributor

@geoffw0 geoffw0 left a comment

This query looks great. I appreciate the effort you've gone to providing tests, documentation and example code to support it.

A couple of real-world results: https://lgtm.com/query/6091759195696304116/

Copy link
Contributor

@geoffw0 geoffw0 left a comment

The failing checks are trivial - you need to correct the file names in the .qhelp and run the auto-formatter on the .ql file (let me know if you don't know how to do that).

@porcupineyhairs
Copy link
Author

@porcupineyhairs porcupineyhairs commented Apr 20, 2022

@geoffw0 Changes done!

Copy link
Contributor

@geoffw0 geoffw0 left a comment

LGTM.

@geoffw0
Copy link

@geoffw0 geoffw0 commented Apr 29, 2022

Looks like this should've been merged.

@geoffw0 geoffw0 merged commit 614a765 into github:main Apr 29, 2022
20 checks passed
@geoffw0
Copy link

@geoffw0 geoffw0 commented Apr 29, 2022

Thanks again for the contribution!

@porcupineyhairs porcupineyhairs deleted the cpam branch Apr 29, 2022
@porcupineyhairs
Copy link
Author

@porcupineyhairs porcupineyhairs commented Apr 29, 2022

@geoffw0 Thanks for the quick turnaround.

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

Successfully merging this pull request may close these issues.

None yet

2 participants