推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
013231
V2EX  ›  Python

pickle 反序列化時是可以執行任意系統命令的

  •  
  •   013231 · Sep 22, 2016 · 3780 views
    This topic created in 3665 days ago, the information mentioned may be changed or developed.
    import pickle
    pickle.loads(b"cos\nsystem\n(S'ls'\ntR.")
    

    上面的代碼中, ls 被執行, 列出了當前目錄下的文件. 這裡可以替換成其他命令, 例如rm -rf *.

    Stackoverflow上的原理解釋.

    5 replies  •  2016-09-23 10:05:58 +08:00
    binux
        1
    binux  
       Sep 22, 2016
    这不是很正常吗?
    ryd994
        3
    ryd994  
       Sep 23, 2016   ❤️ 1
    qiukun
        4
    qiukun  
       Sep 23, 2016 via Android
    所以说无论如何都要读文档啊
    mulog
        5
    mulog  
       Sep 23, 2016
    @phithon 厉害
    iReader 起码也算有挺大体量的公司了 居然这么坑。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2495 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 07:51 · PVG 15:51 · LAX 00:51 · JFK 03:51
    ♥ Do have faith in what you're doing.