Skip to content

Python: Improve the PAM authentication bypass query - #10656

Merged
RasmusWL merged 10 commits into
mainfrom
unknown repository
Dec 8, 2022
Merged

Python: Improve the PAM authentication bypass query#10656
RasmusWL merged 10 commits into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Oct 2, 2022

Copy link
Copy Markdown

The current PAM auth bypass query which was contributed by me a few months back, alert on a vulenrable function but does not check if the function is actually function. This leads to a lot of fasle positives.

With this PR, I add a taint-tracking configuration to check if the username parameter can actually be supplied by an attacker.

This should bring the FP's significantly down.

CC: @RasmusWL

@ghost
ghost self-requested a review as a code owner October 2, 2022 21:09
@github-actions github-actions Bot added the Python label Oct 2, 2022
@RasmusWL RasmusWL self-assigned this Oct 3, 2022
Comment thread python/ql/src/Security/CWE-285/PamAuthorization.ql Fixed
@RasmusWL

Copy link
Copy Markdown
Member

Thanks for your submission @porcupineyhairs, sorry for the late reply, my life has been kinda hectic ⚡ 😴

I agree with the general idea behind these query changes, it will be more accurate if we can track user-controlled data 👍

However, since this query is now promoted to be part of our standard query suite, the code quality will also need to match that of our other queries. So you would need to follow the structure of our other path-problems, which looks like this (using SQL injection as an example):

(as always, ensure proper QLDocs and auto formatting)

@ghost
ghost self-requested a review as a code owner November 17, 2022 01:18
@ghost

ghost commented Nov 17, 2022

Copy link
Copy Markdown
Author

@RasmusWL Changes done! PTAL.

@github-actions github-actions Bot removed the Go label Nov 17, 2022
The current PAM auth bypass query which was contributed by me a few months back, alert on a vulenrable function but does not check if the function is actually function. This leads to a lot of fasle positives.

With this PR, I add a taint-tracking configuration to check if the username parameter can actually be supplied by an attacker.

This should bring the FP's significantly down.
@RasmusWL
RasmusWL removed the request for review from a team November 21, 2022 09:27
RasmusWL
RasmusWL previously approved these changes Nov 28, 2022

@RasmusWL RasmusWL left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @porcupineyhairs 👍 I took the liberty of fixing up a few other small things, so now it looks good to me 👍

I might get some more 👀 on the select text, but other than that, I don't see anything holding us back from merging this.

Please don't make more force pushes to the PR, so we can retain the history 😊

@RasmusWL RasmusWL changed the title Python : Improve the PAM authentication bypass query Python: Improve the PAM authentication bypass query Nov 28, 2022
@ghost

ghost commented Nov 28, 2022

Copy link
Copy Markdown
Author

@RasmusWL Sorry about that. The force push was due to a bunch of unrelated work getting commit with this one. By mistake, I had added about 80-90 go files.

@RasmusWL

Copy link
Copy Markdown
Member

@RasmusWL Sorry about that. The force push was due to a bunch of unrelated work getting commit with this one. By mistake, I had added about 80-90 go files.

no problem. I just meant from now on. My bad if that was unclear.

Comment thread python/ql/lib/change-notes/2022-11-17-py-pam-improve.md Outdated
Comment thread python/ql/lib/change-notes/2022-11-17-py-pam-improve.md Outdated
fix typo

Co-authored-by: intrigus-lgtm <60750685+intrigus-lgtm@users.noreply.github.com>
@ghost
ghost requested a review from RasmusWL November 30, 2022 16:32
@RasmusWL
RasmusWL merged commit d684dbd into github:main Dec 8, 2022
@ghost
ghost deleted the PyPamImprove branch December 8, 2022 12:02
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.

4 participants