LoginSignup
64
30

More than 3 years have passed since last update.

axiosのmaxContentLengthの脆弱性について(2019/05/31)

Last updated at Posted at 2019-06-01

先に結論

axiosを使ってる人は脆弱性があるのでv0.18.1以降に上げましょう
axiosを使っていない人は関係ないのでブラウザバックして大丈夫です。

axiosはJavaScriptのメジャーな通信系のライブラリです。
xhrで実装されているため、レガシーなブラウザやマルチブラウザに対応しています。
https://github.com/axios/axios

GitHub上でセキュリティアラートが・・・

GitHub上でセキュリティアラートが上がっていました。(2019/05/30確認時点)
スクリーンショット 2019-05-30 20.08.56.png

どうゆう脆弱性?

スクリーンショット 2019-06-01 20.24.34.png

Axios up to and including 0.18.0 allows attackers to cause a denial of service (application crash) by continuing to accepting content after maxContentLength is exceeded.

maxContentLengthを超えた場合でも通信処理が行われていて、アプリケーションに負荷をかけ続けるという脆弱性のようです。

詳細は修正のプルリクの例を見たほうがわかりやすいです。
https://github.com/axios/axios/pull/1485

この例だと、100%を超えても通信処理が呼ばれ続けています。

  ticks parent  name
  61777   81.0%  /lib/x86_64-linux-gnu/libc-2.23.so
  61542   99.6%    LazyCompile: *Buffer.concat buffer.js:423:25
  61437   99.8%      Function: ~handleStreamData /home/resure/something/node_modules/axios/lib/adapters/http.js:165:52
  61437  100.0%        Function: ~emitOne events.js:114:17
  61437  100.0%          Function: ~emit events.js:156:44
  61437  100.0%            Function: ~addChunk _stream_readable.js:261:18

axios側の対策

#1485の対応でstream.destroy()関数を呼び出して通信処理を破棄しています。
Destroy stream on exceeding maxContentLength
https://github.com/axios/axios/pull/1485/files
(というかこのプルリク自体は2018/4月からあるのでaxiosチームも認知はしてたんですね・・・)

この脆弱性の対応のために、axiosはv0.19に上がりました。(2019/05/31)
#1485の対応はv0.19に入ってるのでバージョンを上げれば大丈夫のはずです。
追記#1485の対応だけ分離してv0.18.1が出来ていたので、v0.19に一気に上げるよりもこちらを使ったほうが無難そうです。
https://github.com/axios/axios/releases

64
30
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
64
30