4 ms·
The author discovered this exploit in the template engine he wrote (Jinja2).
by icebraining 10y ago
The author discovered this exploit in the template engine he wrote (Jinja2).
- nine_k 10y agoI'll consider switching to a different engine.
- jessaustin 10y agoPerhaps one that hasn't had this exploit fixed yet?
- coldtea 10y agoWhy would a template engine allow for free access to the native platforms string capabilities in the first place?
- obstinate 10y agoNative vs. non-native is irrelevant. A non-native formatting system could have the features of the python formatter that are dangerous. Or, if Python's native formatter lacked these dangerous features, there'd be no reason not to use it.
- coldtea 10y ago>Native vs. non-native is irrelevant. A non-native formatting system could have the features of the python formatter that are dangerous. Hardly irrelevant. The idea is that a non-native formatting system is build specifically for the templating engine, and so the developers controls what it can do and gives it non-dangerous features. >Or, if Python's native formatter lacked these dangerous features, there'd be no reason not to use it Even if it did lack them, it's not under the control of the template platform author, so they should not rely on it for such a crucial part of the template engine as string formatting. (Which is exactly the case here: Python lacked those features before, but got them, and bit the template engine in the back).
- obstinate 10y ago> it's not under the control of the template platform author This doesn't really matter. If it does what you want, it's not like they're going to change the formatter's behavior from under your feet if it's part of the language's default runtime.
- dom0 10y agoWhile the vuln is there, it's a rather obscure way of using the engine in the first place, so in "good" templates it shouldn't be exploitable. See the example in the release: https://www.palletsprojects.com/blog/jinja-281-released/ https://www.palletsprojects.com/blog/jinja-281-released/
- icebraining 10y agoSure, but like tedunangst pointed out, there are valid reasons to allow users to edit those templates, in which case you can't assume they'll be "good".