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

Rule: PTRACE anti-debug attempt #2227

Closed
wants to merge 1 commit into from

Conversation

Brucedh
Copy link
Contributor

@Brucedh Brucedh commented Sep 28, 2022

Signed-off-by: Alessandro Brucato [email protected]

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

/kind release

If contributing rules or changes to rules, please make sure to also uncomment one of the following line:

/kind rule-update

/kind rule-create

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area engine

/area rules

/area tests

/area proposals

/area CI

What this PR does / why we need it:
The ptrace system call is used by debuggers, such as GDB, to examine a target process. Malicious programs will often try to prevent this by using the ptrace system call first, preventing other programs from using it on them. This rule detects that behavior. Legitimate processes may also do this for DRM or diagnostic purposes.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

New rule to detect usages of the PTRACE system call with the PTRACE_TRACEME argument, indicating a program actively attempting to avoid debuggers attaching to the process.

@jasondellaluce
Copy link
Contributor

/milestone 0.34.0

@poiana poiana added this to the 0.34.0 milestone Sep 28, 2022
@darryk10
Copy link
Contributor

darryk10 commented Nov 4, 2022

@loresuso @Kaizhe can you provide your feedback for this rule as well?
We have tested the rule for a while and it looks pretty accurate withouf FPs. If you have any ways we can improve the rule to cover other use cases would be great.
Thanks

Signed-off-by: Alessandro Brucato <[email protected]>
@leogr
Copy link
Member

leogr commented Dec 15, 2022

@loresuso @Kaizhe can you provide your feedback for this rule as well? We have tested the rule for a while and it looks pretty accurate withouf FPs. If you have any ways we can improve the rule to cover other use cases would be great. Thanks

👍

cc @loresuso @darryk10 @Kaizhe

@loresuso
Copy link
Member

My opinion on this is that this anti-debugging technique is the most simple one and most people know about it, and I think it is rarely used because it can be easily bypassed by simply patching calls to this syscall.

I believe malware writers have many other options for anti-debugging, which are more meaningful to me, like timing analysis (if the process is being debugged, execution times will differ from normal execution flow) or just checking if parent process is a known debugger binary, which is also easy to implement like this one. Furthermore, as you pointed out, legitimate processes may use this.

So what I think is that this rule triggering wouldn't be so much relevant for spotting malware, although it can be useful in some cases, I don't know if we want it to be in the default Falco ruleset.

@leogr
Copy link
Member

leogr commented Dec 16, 2022

/milestone 0.35.0

@poiana poiana modified the milestones: 0.34.0, 0.35.0 Dec 16, 2022
@jasondellaluce
Copy link
Contributor

This needs to be ported to https://github.com/falcosecurity/rules

@leogr
Copy link
Member

leogr commented Mar 8, 2023

Copy link
Member

@leogr leogr left a comment

Choose a reason for hiding this comment

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

@poiana
Copy link
Contributor

poiana commented Mar 19, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Brucedh
Once this PR has been reviewed and has the lgtm label, please assign fededp for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@darryk10
Copy link
Contributor

Due to what happened here https://github.com/falcosecurity/rules/pull/37/files I would revaluate this rule once the PR is merged and tested. @Brucedh feel free to start closing this here and open a new one in the new repo falcosecurity/rules.
Thanks

@Brucedh
Copy link
Contributor Author

Brucedh commented Mar 28, 2023

Alright, I close this PR after having ported it to falcosecurity/rules#40

@Brucedh Brucedh closed this Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants