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

feat(events): add stack_pivot event #4403

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

oshaked1
Copy link
Contributor

@oshaked1 oshaked1 commented Dec 2, 2024

Closes #4404

1. Explain what the PR does

Add stack_pivot event, which detects usage of the stack pivoting technique as part of a ROP exploit, by monitoring selected syscalls and verifying the location of the stack pointer.

2. Explain how to test it

Run tracee as follows:

sudo dist/tracee -e stack_pivot.args.syscall=exit_group

Compile and run the tester program:

gcc -o stack_pivot tests/e2e-inst-signatures/scripts/stack_pivot.c
./stack_pivot

After 15 seconds a stack pivot event should be triggered.

3. Other comments

Like suspicious_syscall_source, this event makes use of event parameters to determine which syscalls should be monitored. The new probe group created for suspicious_syscall_source was made generic for "syscall checker" events, and each time a probe is triggered only the "checkers" which selected that syscall are run.

Convert `check_syscall_source` to use this probe instead of having a dedicated probe.
The attachment mechansim is also generic and supports the registration of future syscall checkers.
Golang heaps can be determined by a pattern in the address, dictated by address hints supplied to mmap while allocating memory for them.
Thread stacks can be identified by tracking the stack VMA for all newly created threads.
@oshaked1 oshaked1 force-pushed the stack_pivot branch 2 times, most recently from 9bf7838 to 9c9abd0 Compare December 2, 2024 14:55
This event detects usage of the stack pivot technique used during ROP exploits by checking the user's stack pointer at selected syscalls.
If the stack pointer does not point to the stack, an event is triggered.
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.

Add stack_pivot event
2 participants