LoginSignup
3
3

More than 5 years have passed since last update.

nginxの設定ミスで起こるMultiline response headers

Last updated at Posted at 2018-05-28

はじめに

この記事は下記リンクの日本語翻訳記事です

翻訳が誤っている場合はコメントか@no1zy_secまでお知らせいただけると幸いです。

[add_header_multiline] Multiline response headers

レスポンスヘッダの値を複数行に渡って使用することは避けてください。

理由

  • これらは非推奨です(RFC 7230)
  • いくつかのHTTPクライアントとWebブラウザはRFC 7230を未だにサポートしていません。 (例: IE/Edge/Nginx)

レスポンスヘッダの値を複数行に渡っての使用が原因で起きる脆弱性はこちらのレポートが参考になります。

どうやって見つけるか

設定ミスの例:

# http://nginx.org/en/docs/http/ngx_http_headers_module.html#add_header
add_header Content-Security-Policy "
    default-src: 'none';
    script-src data: https://yastatic.net;
    style-src data: https://yastatic.net;
    img-src data: https://yastatic.net;
    font-src data: https://yastatic.net;";

# https://www.nginx.com/resources/wiki/modules/headers_more/
more_set_headers -t 'text/html text/plain'
    'X-Foo: Bar
        multiline';

対策

唯一の解決策は、multiline response headersを使用しないことです。

関連リンク

nginxの設定ミスで起こるHTTP Splitting
nginxの設定ミスで起こるSSRF
nginxの設定ミスで起こるパス トラバーサル
nginxの設定ミスで起こるレスポンスヘッダの出力不備
nginxの設定ミスで起こるreferer/origin検証の問題
nginxの設定ミスで起こるHostヘッダフォージェリ
nginxの設定ミスで起こるリファラの検証不備

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3