Skip to content

Commit

Permalink
Update change_namespace_privillege_using_unshare.go
Browse files Browse the repository at this point in the history
Signed-off-by: Kapil Sharma <ks3913688@gmail.com>
  • Loading branch information
h4l0gen authored and poiana committed Mar 28, 2024
1 parent 825468b commit 5e0be23
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions events/syscall/change_namespace_privillege_using_unshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ import (
"github.com/falcosecurity/event-generator/events"
)

var _ = events.Register(MaliciousProcessWithUnshare)
var _ = events.Register(ChangeNamespacePrivilegesViaUnshare)

func MaliciousProcessWithUnshare(h events.Helper) error {
if h.InContainer() {
cmd := exec.Command("/bin/sh", "-c", "unshare --fork --pid --mount-proc /bin/bash")
cmd.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: syscall.CLONE_NEWNS | syscall.CLONE_NEWUSER,
}
cmd := exec.Command(unshare)

h.Log().Infof("Change namespace privilleges via unshare")
h.Log().Infof("Change namespace privileges via unshare")

if err := cmd.Run(); err != nil {
return err
Expand Down

0 comments on commit 5e0be23

Please sign in to comment.