- 论坛徽章:
- 0
|
一. 概述
目前通用的隐藏文件方法还是hooksys_getdents64系统调用, 大致流程就是先调用原始的sys_getdents64系统调用,然后在在buf中做过滤。修改sys_call_table是比较原始的rk技术了,碰到好点的管理员, 基本上gdb一下vm[color="#0000ff"]linux就能检测出来。 如何想做到更加隐蔽的话,就要寻找新的技术。 inline hook也是目前比较流行的做法,不容易检测。本文通过讲解一种利用inline hook内核中某函数, 来达到隐藏文件的方法。
二. 剖析sys_getdnts64系统调用
想隐藏文件, 还是要从sys_dents64系统调用下手。 去看下它在内核中是如何实现的。
代码在[color="#0000ff"]linux-2.6.26/fs/readdir.c中:
asmlinkage long sys_getdents64(unsigned int fd, struct linux_dirent64
__user * dirent, unsigned int count)
{
struct file * file;
struct linux_dirent64 __user * lastdirent;
struct getdents_callback64 buf;
int error;
error = -EFAULT;
if (!access_ok(VERIFY_WRITE, dirent, count))
goto out;
error = -EBADF;
file = fget(fd);
if (!file)
goto out;
buf.current_dir = dirent;
buf.previous = NULL;
buf.count = count;
buf.error = 0;
error = vfs_readdir(file, filldir64, &buf);
if (error d_off) d_off = file->f_pos;
error = -EFAULT;
if (__put_user(d_off, &lastdirent->d_off))
goto out_putf;
error = count - buf.count;
}
out_putf:
fput(file);
out:
return error;
}
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/2305/showart_2007729.html |
|