タグ

ブックマーク / shugo.net (1)

  • ファイルオープンの罠 - Journal InTime(2017-12-15)

    _ ファイルオープンの罠 僕が書いたNet::FTPのコードに脆弱性報告があり、修正版がリリースされた。関係者のみなさん、ありがとうございました。 CVE-2017-17405: Net::FTP におけるコマンドインジェクションの脆弱性について 問題があったのは以下のようなコードだった。 def getbinaryfile(remotefile, localfile = File.basename(remotefile), blocksize = DEFAULT_BLOCKSIZE, &block) # :yield: data f = nil result = nil if localfile if @resume rest_offset = File.size?(localfile) f = open(localfile, "a") else rest_offset = nil f

    gfx
    gfx 2017/12/18
    Kernel#open に外部から来た文字列を渡してはいけないという話
  • 1