Ruby On Rails Security Guideの訳 : 4.3 Executable Code in File Uploads
2010年04月23日(金)15:00|木村
こんにちは。木村です。
今回は4.3 Executable Code in File Uploadsです。
原文の単語と全く違う言葉に置きかえている場合が多々あります。原文ページと併せて、ご覧下さい。気になる箇所や間違っている箇所があれば、どうかご指摘下さい。
では、以下訳です。
———————-
4.3 Executable Code in File Uploads
4.3 アップロードファイル内の実行可能なコード
- Source code in uploaded files may be executed when placed in specific directories. Do not place file uploads in Rails’ /public directory if it is Apache’s home directory.
- アップロードファイル内のソースコードは特定のディレクトリに置かれている時に実行される可能性があります。もしRailsの/publicディレクトリがApacheのホームディレクトリならば、アップロードファイルを置かないでください。
The popular Apache web server has an option called DocumentRoot. This is the home directory of the web site, everything in this directory tree will be served by the web server. If there are files with a certain file name extension, the code in it will be executed when requested (might require some options to be set). Examples for this are PHP and CGI files. Now think of a situation where an attacker uploads a file “file.cgi” with code in it, which will be executed when someone downloads the file.
一般に使用されているApache WebサーバにはDocumentRootと呼ばれるオプションがあります。 これはWebサイトのホームディレクトリのことで、Webサーバはこのディレクトリツリーの中にある全てを扱います。もしある拡張子を持ったファイルがあった場合、その中のコードはリクエストされた時に実行されます(いくつかのオプションが設定されている必要があるかもしれない)。PHPやCGIファイルがそれに当たります。さて、攻撃者がコードが含まれた”file.cgi”ファイルをアップロードするシチュエーションを考えてください。誰かがそのファイルをダウンロードする(リクエストを出した)時そのファイルは実行されるでしょう。
If your Apache DocumentRoot points to Rails’ /public directory, do not put file uploads in it, store files at least one level downwards.
もしApacheのDocumentRootがRailsの/publicディレクトリになっているならば、そこにアップロードファイルを置かずに、少なくとも1階層下にファイルを保存してください。
———————-
次回は4.4 File Downloadsです。