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

Added an event for default stable rule "PTRACE attached to process" #133

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

GLVSKiriti
Copy link
Contributor

What type of PR is this?

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

/kind bug

/kind cleanup

/kind documentation

/kind tests

/kind feature

Any specific area of the project related to this PR?

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

/area commands

/area pkg

/area events

What this PR does / why we need it:
Added an event for default stable rule "PTRACE attached to process" mentioned here

Which issue(s) this PR fixes:

Fixes #131

Special notes for your reviewer:

Signed-off-by: GLVS Kiriti <glvskiriti2003369@gmail.com>
@GLVSKiriti
Copy link
Contributor Author

GLVSKiriti commented Mar 22, 2024

Below is the screenshot where test is successful and a warning message produces on left terminal on executing event(ptrace attach) code as expected

PtraceAttachedToProcess

Signed-off-by: GLVS Kiriti <glvskiriti2003369@gmail.com>
@GLVSKiriti
Copy link
Contributor Author

GLVSKiriti commented Apr 3, 2024

@FedeDP @leogr In this I am creating a dummy process which sleeps for 1hr (And also did the cleanup at end too)
And attaching the current process to the dummy process with ptraceattach syscall which triggers the stable rule

// Start a dummy process which sleeps for 1hr
cmd := exec.Command("sleep", "3600")
if err := cmd.Start(); err != nil {
h.Log().WithError(err).Error("Failed to start dummy process")
return err
}
pid := cmd.Process.Pid
h.Log().Infof("Attached to dummy process with PID %d using PTRACE_ATTACH", pid)
defer syscall.PtraceDetach(pid) // Detach the process at end
defer cmd.Process.Kill() // Kill the dummy process at end
// Attach to the target process using PTRACE_ATTACH
return syscall.PtraceAttach(pid)

Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link

poiana commented Apr 4, 2024

LGTM label has been added.

Git tree hash: 71c8613391583b6ccf294008e2d8f76af4adbb4d

@poiana
Copy link

poiana commented Apr 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, GLVSKiriti

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

The pull request process is described 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

@poiana poiana added the approved label Apr 4, 2024
@poiana poiana merged commit 2250ff8 into falcosecurity:main Apr 4, 2024
4 checks passed
@GLVSKiriti GLVSKiriti deleted the PtraceAttachedToProcess branch April 4, 2024 08:35
@leogr leogr added this to the v0.12.0 milestone Oct 2, 2024
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 an event for default stable rule "PTRACE attached to process"
4 participants