-
Notifications
You must be signed in to change notification settings - Fork 40
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
adding event on Redirect stdout/stdin to network connection in container
#185
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: h4l0gen 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 |
Redirect stdout/stdin to network connection in container
Redirect stdout/stdin to network connection in container
Hey @leogr and @FedeDP, just an attempt to redirect
|
Redirect stdout/stdin to network connection in container
Redirect stdout/stdin to network connection in container
func redirectStdout(conn net.Conn) error { | ||
// Duplicate the file descriptor of the network connection | ||
remoteFile, _ := conn.(*net.TCPConn).File() | ||
defer remoteFile.Close() | ||
|
||
// Duplicate the file descriptor of stdout | ||
stdoutFile := os.Stdout.Fd() | ||
|
||
// Redirect stdout to the network connection using dup2 | ||
if err := syscall.Dup2(int(remoteFile.Fd()), int(stdoutFile)); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to me a good candidate for utils_linux.go
🤔 @FedeDP wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree @leogr !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @h4l0gen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leogr changes done. PTAL again.
Signed-off-by: h4l0gen <[email protected]> redirectStdout function shifted to utils_linux.go Signed-off-by: h4l0gen <[email protected]> updated Signed-off-by: h4l0gen <[email protected]>
Issues go stale after 90d of inactivity. Mark the issue as fresh with Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with Provide feedback via https://github.com/falcosecurity/community. /lifecycle stale |
/remove-lifecycle stale |
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area events
What this PR does / why we need it:
this PR triggers rule which prevent potential reverse shell or remote code execution.
Which issue(s) this PR fixes:
Fixes #184
Special notes for your reviewer: