<menu id="guoca"></menu>
<nav id="guoca"></nav><xmp id="guoca">
  • <xmp id="guoca">
  • <nav id="guoca"><code id="guoca"></code></nav>
  • <nav id="guoca"><code id="guoca"></code></nav>

    SaltStack 任意文件讀寫漏洞(CVE-2020-11652)

    Path saltstack/CVE-2020-11652

    SaltStack 是基于 Python 開發的一套C/S架構配置管理工具。國外某安全團隊披露了 SaltStack 存在認證繞過漏洞(CVE-2020-11651)和目錄遍歷漏洞(CVE-2020-11652)。

    在 CVE-2020-11652 目錄遍歷漏洞中,攻擊者通過構造惡意請求,可以讀取、寫入服務器上任意文件。

    參考鏈接:

    漏洞環境

    執行如下命令啟動一個SaltStack Master服務:

    docker-compose up -d

    環境啟動后,將會在本地監聽如下端口:

    • 4505/4506 這是SaltStack Master與minions通信的端口
    • 8000 這是Salt的API端口
    • 2222 這是容器內部的SSH服務器監聽的端口

    漏洞復現

    本文檔復現CVE-2020-11652漏洞,參考漏洞作者的說明:

    The wheel module contains commands used to read and write files under specific directory paths. The inputs to these functions are concatenated with the target directory and the resulting path is not canonicalized, leading to an escape of the intended path restriction.

    wheel/file_roots.py文件中的write方法,使用os.path.isabs來判斷用戶輸入是否是絕對路徑,可能目的是防止寫入其他目錄,但實際上攻擊者可以通過../的方式跳轉至根目錄,進而寫入任意文件:

    msg = {
        'key': root_key,
        'cmd': 'wheel',
        'fun': 'file_roots.write',
        'path': '../../path/to/target',
        'data': 'test'
    #    'saltenv': 'base',
      }

    參考這個項目,編寫一個簡單的POC,寫入/etc/cron.d/shell,利用crontab執行任意命令:

    id > /tmp/success成功被執行。

    本文章首發在 網安wangan.com 網站上。

    上一篇 下一篇
    討論數量: 0
    只看當前版本


    暫無話題~
    亚洲 欧美 自拍 唯美 另类