2

Is anyone aware of any security issues with the use of <img src="data:xxxxx"> where the user supplies the content? Assume the content is validated so it fits the format for a data URI so it can't break out of the tag, and is also restricted to image mime types.

http://en.wikipedia.org/wiki/Data_URI_scheme

4

2 に答える 2

2

間違いなく別のコードが含まれていますが、通常の img リンクよりも攻撃されやすいわけではありません。

于 2012-05-08T18:09:10.910 に答える
1

これは安全であるべきだと思います。画像のデータ URI 構文は非常に厳密であるため、次のようになります。

data:image/<subtype>;base64,<base64-stream>

検証は簡単です(たとえば、Base64データを解析または検証するためのRegExを参照してください)。

考えられる唯一の脆弱性は、画像を解析/レンダリングするコンポーネント内の脆弱性です。

于 2012-05-08T18:40:54.077 に答える