summaryrefslogtreecommitdiff
path: root/qutebrowser/html/settings.html
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2018-07-09 23:38:47 +0200
committerFlorian Bruhin <git@the-compiler.org>2018-07-11 17:07:59 +0200
commitc2ff32d92ba9bf40ff53498ee04a4124d4993c85 (patch)
treeaa8130a54e7ea9b58f2b4192954deff26fd97d12 /qutebrowser/html/settings.html
parent718f73be2eb062f4893a463bca34c18feeded251 (diff)
downloadqutebrowser-c2ff32d92ba9bf40ff53498ee04a4124d4993c85.tar.gz
qutebrowser-c2ff32d92ba9bf40ff53498ee04a4124d4993c85.zip
CVE-2018-10895: Fix CSRF issues with qute://settings/set URLv1.3.x
In ffc29ee043ae7336d9b9dcc029a05bf7a3f994e8 (part of v1.0.0), a qute://settings/set URL was added to change settings. Contrary to what I apparently believed at the time, it *is* possible for websites to access `qute://*` URLs (i.e., neither QtWebKit nor QtWebEngine prohibit such requests, other than the usual cross-origin rules). In other words, this means a website can e.g. have an `<img>` tag which loads a `qute://settings/set` URL, which then sets `editor.command` to a bash script. The result of that is arbitrary code execution. Fixes #4060 See #2332 (cherry picked from commit 43e58ac865ff862c2008c510fc5f7627e10b4660)
Diffstat (limited to 'qutebrowser/html/settings.html')
-rw-r--r--qutebrowser/html/settings.html3
1 files changed, 2 insertions, 1 deletions
diff --git a/qutebrowser/html/settings.html b/qutebrowser/html/settings.html
index 62b424a59..d4ff4ce34 100644
--- a/qutebrowser/html/settings.html
+++ b/qutebrowser/html/settings.html
@@ -3,7 +3,8 @@
{% block script %}
var cset = function(option, value) {
// FIXME:conf we might want some error handling here?
- var url = "qute://settings/set?option=" + encodeURIComponent(option);
+ var url = "qute://user:{{csrf_token}}@settings/set"
+ url += "?option=" + encodeURIComponent(option);
url += "&value=" + encodeURIComponent(value);
var xhr = new XMLHttpRequest();
xhr.open("GET", url);