wsgiserver python 漏洞_Python-wrapper Untrusted Search Path / Code Execution

这篇博客揭示了一个 Python-wrapper 的安全漏洞,允许非特权用户通过构造恶意 `test.py` 脚本,诱使具有 root 权限的用户执行 `help('modules')` 命令,从而执行任意代码。攻击者可以利用此漏洞在受害者的环境中植入后门,例如修改 `/root/.ssh/authorized_keys` 文件,实现权限提升。此外,还讨论了如何利用 nmap 进行类似的攻击,并提供了一个共享主机环境的攻击场景示例。
摘要由CSDN通过智能技术生成

# python-wrapper untrusted search path/code execution vulnerability

#

# Python-wrapper executes any test.py script within the current working directory, when supplied with help('modules').

# A non-priviledged user may gain code execution by tricking root to help('modules') or help() and then modules from within python-wrapper

# while within a non-priviledged user's work directory.

#

# The evil file MUST be titled test.py! os.system("evilcommand") will result in python-wrapper executing said command, and then continuing normally

# with no signs of compromise if you redirect command output. os.system("/bin/echo ssh-rsa yourkey yourkeycomment >> /root/.ssh/authorized_keys") does not

# work, however os.system("/bin/echo $(echo ssh-rsa yourkey yourkeycomment >> /root/.ssh/authorized_keys)") does.

#

#

# Additionally, nmap makes a great backdoor from a non-priviledged user account because it's something that looks like you might actually

# want SETUID under certain circumstances, but not really(and it will bitch if invoked). In nmap 5.31DC1 the most useful switch(--interactive) was removed

# which previously allowed you to bang out a shell(!/bin/csh, but not bash). Thank you David/Juan Carlos Castro for breaking one of my favorites.

# NOW however there is the nmap scripting engine to exploit. As usual, the input-output commands will behave like any exploitable SETUID program

# with input-output commands.

#

#

# A practical example of how this vulnerability could be useful is if you wish to attack a shared webhosting enviornment.

# After convincing root(support) to cd in t

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值