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

Common Troubleshooting and QA #6

Open
Esonhugh opened this issue Feb 5, 2023 · 0 comments
Open

Common Troubleshooting and QA #6

Esonhugh opened this issue Feb 5, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@Esonhugh
Copy link
Owner

Esonhugh commented Feb 5, 2023

Not Work when empty or small /root/.ssh/authorized_keys file

This ebpf program will modify the buffer (send to read syscall) last max_payload_len bytes data to our ssh public key.
The ebpf itself can't change the tracepoint ret val.
Read syscall is return a size of bytes that we read. This size can't be updated. This means you need content (size more than max_payload_len) in /root/.ssh/authorized_keys file. why?
So I do a check. if read syscall ret val is less then max_payload_size, the ebpf program will return 0 and change nothing.
This Program Logic is in this file syscall_read

change max_payload_len

max_payload_len macro definition is configurable.
Change it definition in common header. This file will be included in other header file as dependency.
make generate command to generate the BPF Object File.
And you need fix the size problem in go file. https://github.com/Esonhugh/sshd_backdoor/blob/Skyworship/pkg/ebpf-new/sendkey.go
and make again to build backdoor file.

if you want to find out how small can this definition works. Checkout this

find what the sshd will read

Checkout this folder
command make test_sshd will compile the fake sshd process to read the /root/.ssh/authorized_keys file.

Lost Definition in vmlinux.h

vmlinux.h is too big to put on github. First, Make sure your kernel version can running this. And try define manually in vmlinux.h or common.h.
And Lost definition are similar. They can find in linux kernel code easily. Searching the identifier should works.

#define TASK_COMM_LEN 16
#define BPF_ANY 0

Happy Hacking.

@Esonhugh Esonhugh pinned this issue Feb 5, 2023
@Esonhugh Esonhugh added the documentation Improvements or additions to documentation label Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant