-
Notifications
You must be signed in to change notification settings - Fork 1.7k
CPP: PAM Authorization Bypass #8775
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
Conversation
This PR is similar to my other PRs for [Python](#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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/
cpp/ql/src/experimental/Security/CWE/CWE-285/PamAuthorization.ql
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
cpp/ql/src/experimental/Security/CWE/CWE-285/PamAuthorization.qhelp
Outdated
Show resolved
Hide resolved
cpp/ql/src/experimental/Security/CWE/CWE-285/PamAuthorization.qhelp
Outdated
Show resolved
Hide resolved
@geoffw0 Changes done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Looks like this should've been merged. |
Thanks again for the contribution! |
@geoffw0 Thanks for the quick turnaround. |
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 thepam_acct_mgmt
method. This is bad as a call topam_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 thepam_acct_mgmt
function after apam_authenticate
function.