免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1025 | 回复: 0
打印 上一主题 下一主题

分享:Linux操作系统下隐藏文件 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-07-26 15:11 |只看该作者 |倒序浏览
一. 概述
目前通用的隐藏文件方法还是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
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP