Node.jsはヌルバイト脆弱性はありますか?

297 views
Skip to first unread message

遠州律夫

unread,
Jul 29, 2014, 10:12:46 PM7/29/14
to node...@googlegroups.com
PHPの脆弱性について調べていたんですが、
Node.jsはヌルバイト脆弱性はあるんですか?
PHPでいうバイナリセーフ関数はあるんですか?

Shigeki Ohtsu

unread,
Jul 30, 2014, 12:36:26 AM7/30/14
to node...@googlegroups.com
大津です。

(2014/07/30 11:12), 遠州律夫 wrote:
> PHPの脆弱性について調べていたんですが、
> Node.jsはヌルバイト脆弱性はあるんですか?
> PHPでいうバイナリセーフ関数はあるんですか?

Node APIで明示的にNull byteチェックしているのは fs モジュールぐらいです。

$ node -e "require('fs').openSync('hoge\0fuga');"

fs.js:121
throw er;
^
Error: Path must be a string without null bytes.
at nullCheck (fs.js:119:14)
at Object.fs.openSync (fs.js:431:3)
at [eval]:1:15
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:456:26)
at evalScript (node.js:536:25)
at startup (node.js:80:7)
at node.js:906:3

APIを全部チェックしてないですが、binary safe なものが多いのですけど
child_process 関連などは危ないかもしれないです。

外部からの入力に関しては、基本厳しくサニタイジングして、脆弱性を避けるこ
とが必要です。

遠州律夫

unread,
Aug 10, 2014, 5:26:44 AM8/10/14
to node...@googlegroups.com
expressを使っていますが、
注意したほうがいいことや、
おすすめのサニタイザはありますか?

2014年7月30日水曜日 11時12分46秒 UTC+9 遠州律夫:
PHPの脆弱性について調べていたんですが、
Node.jsはヌルバイト脆弱性はあるんですか?
PHPでいうバイナリセーフ関数はあるんですか?
Reply all
Reply to author
Forward
0 new messages