CVE-2020-26249: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (CWE-79)
value: Red Discord Bot Dashboard is an easy-to-use interactive web dashboard to control your Redbot. In Red Discord Bot before version 0.1.7a an RCE exploit has been discovered. This exploit allows Discord users with specially crafted Server names and Usernames/Nicknames to inject code into the webserver front-end code. By abusing this exploit, it's possible to perform destructive actions and/or access sensitive information. This high severity exploit has been fixed on version 0.1.7a. There are no workarounds, bot owners must upgrade their relevant packages (Dashboard module and Dashboard webserver) in order to patch this issue.
CWE description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
CVSS v3 base score: 8.7
Published: 2020-12-09T00:15Z
Repository: https://github.com/Cog-Creators/Red-Dashboard
Language: HTML
Files changed: reddash/app/home/templates/dashboard.html
Commit date: 2020-11-30 11:49:18 +0000
Commit message: Fix unformatted HTML

Diff: diff --git a/reddash/app/home/templates/dashboard.html b/reddash/app/home/templates/dashboard.html
index afdfbc5..9574226 100755
--- a/reddash/app/home/templates/dashboard.html
+++ b/reddash/app/home/templates/dashboard.html
@@ -70,25 +70,29 @@
                 if (json.data.length === 0) {
                     $("#serverrow").html(`<div class="col-md-12"><h1>{{ _("You're not in any servers with elevated permissions!") }}</h1></div>`)
                 } else {
                     var base_guild_url = "{{ url_for('home_blueprint.guild', guild='123456789123456789') }}"
                     $("#serverrow").html("")
+                    let counter = 0
                     for (let g of json.data) {
                         var current_guild_url = base_guild_url.replace("123456789123456789", g.id)
                         $("#serverrow").append(`
                             <div class="col-xl-2 col-lg-3 col-md-4 col-sm-6 col-12 guildcard" style="margin-bottom: 50px">
                                 <a href="${current_guild_url}">
                                     <div class="card h-100" onmouseover="playGif(this)" onmouseout="stopGif(this)">
                                         <img class="card-img-top" src="${g.icon}png" alt="Card image cap" data-src-url="${g.icon}" data-is-animated=${g.animated}>
                                         <div class="card-body">
-                                            <h5 class="card-title">${g.name}</h5>
-                                            <p class="card-text">Owner: ${g.owner}</p>
+                                            <h5 class="card-title" id="guild-counter-${counter}">Loading...</h5>
+                                            <p class="card-text" id="owner-counter-${counter}">Owner: Loading...</p>
                                         </div>
                                     </div>
                                 </a>
                             </div>
                         `)
+                        $(`#guild-counter-${counter}`).text(g.name)
+                        $(`#owner-counter-${counter}`).text(g.owner)
+                        counter += 1
                     }
                 }
             }
         }
         try {

Vulnerable code:                                             <h5 class="card-title">${g.name}</h5>
                                            <p class="card-text">Owner: ${g.owner}</p>
Fixed code:                     let counter = 0
                                            <h5 class="card-title" id="guild-counter-${counter}">Loading...</h5>
                                            <p class="card-text" id="owner-counter-${counter}">Owner: Loading...</p>
                        $(`#guild-counter-${counter}`).text(g.name)
                        $(`#owner-counter-${counter}`).text(g.owner)
                        counter += 1