Skip to content

eventlog_creds Module #452

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

Merged
merged 10 commits into from
May 18, 2025
Merged

eventlog_creds Module #452

merged 10 commits into from
May 18, 2025

Conversation

lodos2005
Copy link
Contributor

@lodos2005 lodos2005 commented Oct 13, 2024

Screenshot 2024-10-14 at 01 03 53 Screenshot 2024-10-14 at 01 03 20

I have added a new module that extracts user credentials from Windows event logs. The main focus is on monitoring logs, such as Sysmon or Windows Security logs Event ID 4688. If computers are monitored using Windows Event Forwarding (WEF) or SIEM solutions, executed commands and their arguments can be stored in the event log. I designed this module to find credentials in those logs and extract them.

add new module

Signed-off-by: Hakan Yavuz <[email protected]>
Signed-off-by: Hakan Yavuz <[email protected]>
fix for lint

Signed-off-by: Hakan Yavuz <[email protected]>
@NeffIsBack
Copy link
Member

Thanks for the PR :)

@Dfte
Copy link
Contributor

Dfte commented Oct 14, 2024

Hey dude!

Really nice PR! Is there a way you can retrieve the event log files without running additional execute() operation ?

@lodos2005
Copy link
Contributor Author

lodos2005 commented Oct 14, 2024

Hey dude!

Really nice PR! Is there a way you can retrieve the event log files without running additional execute() operation ?

Hm, maybe we use even/even6, i will look that.

Signed-off-by: Hakan Yavuz <[email protected]>
add rpc method, 

Signed-off-by: Hakan Yavuz <[email protected]>
@lodos2005
Copy link
Contributor Author

well, i added rpc method also. rpc call is a bit slower on large logs but I think it is more stealth.
Screenshot 2024-10-15 at 01 18 52
Screenshot 2024-10-15 at 01 18 08
I don't know which one should be the default.

fix for linter, spaces

Signed-off-by: Hakan Yavuz <[email protected]>
@Dfte
Copy link
Contributor

Dfte commented Oct 15, 2024

Amazing!!! To be honest I'd rather have RPC being the default one as it will improve stealthness and allow attacker to dump credentials without rising alerts because of the execute :)

@NeffIsBack
Copy link
Member

@lodos2005 how do you enable the event tracking? Tried enabling "Administrative Templates\System\Audit Process Creation\Include command line in process creation events" (see here), but i don't see any 4688 events in the logs.

@lodos2005
Copy link
Contributor Author

lodos2005 commented May 3, 2025

@NeffIsBack Can you try with template
Computer Configuration -> Windows Settings -> Security Settings -> Advanced Audit Policy Configuration -> System Audit Policies -> Detailed Tracking -> Audit Process Creation
Or cmdline
AuditPol /set /subcategory:"Process Creation" /success:enable

also i found reg key
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\Audit" /v ProcessCreationIncludeCmdLine_Enabled /t REG_DWORD /d 1 /f

@NeffIsBack
Copy link
Member


@NeffIsBack Can you try with template Computer Configuration -> Windows Settings -> Security Settings -> Advanced Audit Policy Configuration -> System Audit Policies -> Detailed Tracking -> Audit Process Creation Or cmdline AuditPol /set /subcategory:"Process Creation" /success:enable

also i found reg key reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\Audit" /v ProcessCreationIncludeCmdLine_Enabled /t REG_DWORD /d 1 /f

Awesome, that worked. So for others reading this, both of the following options must be configured:

  • Computer Configuration -> Windows Settings -> Security Settings -> Advanced Audit Policy Configuration -> System Audit Policies -> Detailed Tracking -> Audit Process Creation must be set to "Success"
  • Administrative Templates\System\Audit Process Creation\Include command line in process creation events must be set to "Enabled"

NeffIsBack
NeffIsBack previously approved these changes May 15, 2025
Copy link
Member

@NeffIsBack NeffIsBack left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the PR!
image

@lodos2005
Copy link
Contributor Author

Awesome 💙

@NeffIsBack NeffIsBack merged commit 844af80 into Pennyw0rth:main May 18, 2025
5 checks passed
@dadevel
Copy link

dadevel commented May 18, 2025

@lodos2005 I want to contribute a PR that connects to the EVEN6 RPC interface over SMB \PIPE\eventlog instead of the high TCP port, but over SMB EvtRpcRegisterLogQuery() fails with rpc_s_access_denied while it works fine over TCP. Do you have any idea why?

@NeffIsBack
Copy link
Member

Can you post the code? That could probably help identifying the problem

@dadevel
Copy link

dadevel commented May 19, 2025

@NeffIsBack yes, I built a standalone reproducer: https://gist.github.com/dadevel/d4e8906424278f65d0cf8b9bf3aea906

@NeffIsBack
Copy link
Member

@NeffIsBack yes, I built a standalone reproducer: https://gist.github.com/dadevel/d4e8906424278f65d0cf8b9bf3aea906

Looks indeed like a privilege issue on your side. Your script works flawlessly with the domain admin in my lab:
image

@dadevel
Copy link

dadevel commented May 20, 2025

Thanks for testing! Can you try with --protocol smb? The script uses RPC over TCP by default (I probably should've changed that).

@NeffIsBack
Copy link
Member

Hmm nope, no luck:
image

Neither with your implementation, nor with the one out of coerce_plus (which does practically the same thing, but wanted to check if there was bug or anything else)

@dadevel
Copy link

dadevel commented May 21, 2025

Windows is weird. At least I know now that it wasn't me :D
Thank you again for helping out.

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