Skip to content

Commit 6285655

Browse files
TrixterTheTuxDaneEveritt
authored andcommitted
Apply security fixes from pterodactyl#2441 to 1.0
1 parent 3473e1d commit 6285655

File tree

3 files changed

+44
-24
lines changed

3 files changed

+44
-24
lines changed

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ This file is a running track of new features and fixes to each version of the pa
33

44
This project follows [Semantic Versioning](http://semver.org) guidelines.
55

6+
## v0.7.19 (Derelict Dermodactylus)
7+
### Fixed
8+
* **[Security]** Fixes XSS in the admin area's server owner selection.
9+
10+
## v0.7.18 (Derelict Dermodactylus)
11+
### Fixed
12+
* **[Security]** Re-addressed missed endpoint that would not properly limit a user account to 5 API keys.
13+
* **[Security]** Addresses a Client API vulnerability that would allow a user to list all servers on the system ([`GHSA-6888-7f3w-92jx`](https://github.com/pterodactyl/panel/security/advisories/GHSA-6888-7f3w-92jx))
14+
615
## v0.7.17 (Derelict Dermodactylus)
716
### Fixed
817
* Limited accounts to 5 API keys at a time.
@@ -301,7 +310,7 @@ the response from the server `GET` endpoint.
301310
* Nest and Egg listings now show the associated ID in order to make API requests easier.
302311
* Added star indicators to user listing in Admin CP to indicate users who are set as a root admin.
303312
* Creating a new node will now requires a SSL connection if the Panel is configured to use SSL as well.
304-
* Connector error messages due to permissions are now rendered correctly in the UI rather than causing a silent failure.
313+
* Socketio error messages due to permissions are now rendered correctly in the UI rather than causing a silent failure.
305314
* File manager now supports mass deletion option for files and folders.
306315
* Support for CS:GO as a default service option selection.
307316
* Support for GMOD as a default service option selection.
@@ -431,7 +440,7 @@ the response from the server `GET` endpoint.
431440
* Changed 2FA login process to be more secure. Previously authentication checking happened on the 2FA post page, now it happens prior and is passed along to the 2FA page to avoid storing any credentials.
432441

433442
### Added
434-
* Connector error messages due to permissions are now rendered correctly in the UI rather than causing a silent failure.
443+
* Socketio error messages due to permissions are now rendered correctly in the UI rather than causing a silent failure.
435444

436445
## v0.7.0-beta.1 (Derelict Dermodactylus)
437446
### Added

public/themes/pterodactyl/js/admin/new-server.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ function updateAdditionalAllocations() {
153153
}
154154

155155
function initUserIdSelect(data) {
156+
function escapeHtml(str) {
157+
var div = document.createElement('div');
158+
div.appendChild(document.createTextNode(str));
159+
return div.innerHTML;
160+
}
161+
156162
$('#pUserId').select2({
157163
ajax: {
158164
url: '/admin/users/accounts.json',
@@ -176,28 +182,27 @@ function initUserIdSelect(data) {
176182
data: data,
177183
escapeMarkup: function (markup) { return markup; },
178184
minimumInputLength: 2,
179-
180185
templateResult: function (data) {
181-
if (data.loading) return data.text;
186+
if (data.loading) return escapeHtml(data.text);
182187

183188
return '<div class="user-block"> \
184-
<img class="img-circle img-bordered-xs" src="https://www.gravatar.com/avatar/' + data.md5 + '?s=120" alt="User Image"> \
185-
<span class="username"> \
186-
<a href="#">' + data.name_first + ' ' + data.name_last +'</a> \
187-
</span> \
188-
<span class="description"><strong>' + data.email + '</strong> - ' + data.username + '</span> \
189-
</div>';
189+
<img class="img-circle img-bordered-xs" src="https://www.gravatar.com/avatar/' + escapeHtml(data.md5) + '?s=120" alt="User Image"> \
190+
<span class="username"> \
191+
<a href="#">' + escapeHtml(data.name_first) + ' ' + escapeHtml(data.name_last) +'</a> \
192+
</span> \
193+
<span class="description"><strong>' + escapeHtml(data.email) + '</strong> - ' + escapeHtml(data.username) + '</span> \
194+
</div>';
190195
},
191-
192196
templateSelection: function (data) {
193197
return '<div> \
194-
<span> \
195-
<img class="img-rounded img-bordered-xs" src="https://www.gravatar.com/avatar/' + data.md5 + '?s=120" style="height:28px;margin-top:-4px;" alt="User Image"> \
196-
</span> \
197-
<span style="padding-left:5px;"> \
198-
' + data.name_first + ' ' + data.name_last + ' (<strong>' + data.email + '</strong>) \
199-
</span> \
200-
</div>';
198+
<span> \
199+
<img class="img-rounded img-bordered-xs" src="https://www.gravatar.com/avatar/' + escapeHtml(data.md5) + '?s=120" style="height:28px;margin-top:-4px;" alt="User Image"> \
200+
</span> \
201+
<span style="padding-left:5px;"> \
202+
' + escapeHtml(data.name_first) + ' ' + escapeHtml(data.name_last) + ' (<strong>' + escapeHtml(data.email) + '</strong>) \
203+
</span> \
204+
</div>';
201205
}
206+
202207
});
203208
}

resources/views/admin/servers/view/details.blade.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
@section('footer-scripts')
6767
@parent
6868
<script>
69+
function escapeHtml(str) {
70+
var div = document.createElement('div');
71+
div.appendChild(document.createTextNode(str));
72+
return div.innerHTML;
73+
}
74+
6975
$('#pUserId').select2({
7076
ajax: {
7177
url: '/admin/users/accounts.json',
@@ -85,14 +91,14 @@
8591
escapeMarkup: function (markup) { return markup; },
8692
minimumInputLength: 2,
8793
templateResult: function (data) {
88-
if (data.loading) return data.text;
94+
if (data.loading) return escapeHtml(data.text);
8995
9096
return '<div class="user-block"> \
91-
<img class="img-circle img-bordered-xs" src="https://www.gravatar.com/avatar/' + data.md5 + '?s=120" alt="User Image"> \
97+
<img class="img-circle img-bordered-xs" src="https://www.gravatar.com/avatar/' + escapeHtml(data.md5) + '?s=120" alt="User Image"> \
9298
<span class="username"> \
93-
<a href="#">' + data.name_first + ' ' + data.name_last +'</a> \
99+
<a href="#">' + escapeHtml(data.name_first) + ' ' + escapeHtml(data.name_last) +'</a> \
94100
</span> \
95-
<span class="description"><strong>' + data.email + '</strong> - ' + data.username + '</span> \
101+
<span class="description"><strong>' + escapeHtml(data.email) + '</strong> - ' + escapeHtml(data.username) + '</span> \
96102
</div>';
97103
},
98104
templateSelection: function (data) {
@@ -108,10 +114,10 @@
108114
109115
return '<div> \
110116
<span> \
111-
<img class="img-rounded img-bordered-xs" src="https://www.gravatar.com/avatar/' + data.md5 + '?s=120" style="height:28px;margin-top:-4px;" alt="User Image"> \
117+
<img class="img-rounded img-bordered-xs" src="https://www.gravatar.com/avatar/' + escapeHtml(data.md5) + '?s=120" style="height:28px;margin-top:-4px;" alt="User Image"> \
112118
</span> \
113119
<span style="padding-left:5px;"> \
114-
' + data.name_first + ' ' + data.name_last + ' (<strong>' + data.email + '</strong>) \
120+
' + escapeHtml(data.name_first) + ' ' + escapeHtml(data.name_last) + ' (<strong>' + escapeHtml(data.email) + '</strong>) \
115121
</span> \
116122
</div>';
117123
}

0 commit comments

Comments
 (0)