diff options
| author | Hauke Mehrtens <hauke@hauke-m.de> | 2021-06-09 01:28:44 +0200 |
|---|---|---|
| committer | Hauke Mehrtens <hauke@hauke-m.de> | 2021-06-09 21:07:45 +0200 |
| commit | 15ca915da92686dce86be05c205118f57ec7015a (patch) | |
| tree | e244b76f0bf5ae0165057a959249f7ab58a47f20 | |
| parent | 91f392950096896d7ed66fc697fc06ba884995af (diff) | |
themes: Call striptags() on hostname to prevent XSS
This calls striptags() on the hostname to prevent any XSS over the
hostname. This should fix CVE-2021-33425 as far as I understood it.
If someone adds some Javascript into system.@system[0].hostname it would
have been directly added to the page, this prevents the problem.
This can only be exploited by someone being able to modify the uci
configuration, normally a user with such privileges could also just
modify the webpage.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 5cbd79d7e31c0f0feaea2770bf102bbae7831e3c)
3 files changed, 3 insertions, 3 deletions
diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm index 5e3687935b..99ffc21074 100644 --- a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm +++ b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm @@ -41,7 +41,7 @@ <header> <div class="fill"> <div class="container"> - <a class="brand" href="#"><%=boardinfo.hostname or "?"%></a> + <a class="brand" href="#"><%=striptags(boardinfo.hostname or "?")%></a> <ul class="nav" id="topmenu" style="display:none"></ul> <div id="indicators" class="pull-right"></div> </div> diff --git a/themes/luci-theme-material/luasrc/view/themes/material/header.htm b/themes/luci-theme-material/luasrc/view/themes/material/header.htm index 5abfb481b6..d6e50c40cd 100644 --- a/themes/luci-theme-material/luasrc/view/themes/material/header.htm +++ b/themes/luci-theme-material/luasrc/view/themes/material/header.htm @@ -190,7 +190,7 @@ <div class="container"> <span class="showSide"></span> <a id="logo" href="<% if luci.dispatcher.context.authsession then %><%=url('admin/status/overview')%><% else %>#<% end %>"><img src="<%=media%>/brand.png" alt="OpenWrt"></a> - <a class="brand" href="#"><%=boardinfo.hostname or "?"%></a> + <a class="brand" href="#"><%=striptags(boardinfo.hostname or "?")%></a> <div class="status" id="indicators"> <span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()"> <span class="label success" id="xhr_poll_status_on"><span class="mobile-hide"><%:Auto Refresh%></span> <%:on%></span> diff --git a/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm b/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm index fafd86f35e..77c86596fc 100644 --- a/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm +++ b/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm @@ -50,7 +50,7 @@ <h2 class="navigation"><a id="navigation" name="navigation"><%:Navigation%></a></h2> <div class="hostinfo"> - <%=(boardinfo.hostname or "?")%> | <%=ver.distversion%> | + <%=striptags(boardinfo.hostname or "?")%> | <%=ver.distversion%> | <%:Load%>: <%="%.2f" % (loadinfo[1] / 65535.0)%> <%="%.2f" % (loadinfo[2] / 65535.0)%> <%="%.2f" % (loadinfo[3] / 65535.0)%> </div> |
