CVE-2019-8349 XSS vulnerabilities fix

This commit is contained in:
danpros 2020-05-06 13:06:59 +07:00
commit ec1cf1d303
19 changed files with 31 additions and 190 deletions

View file

@ -695,7 +695,7 @@ function get_user_posts()
$i++;
echo '<tr class="' . $class . '">';
echo '<td><a target="_blank" href="' . $p->url . '">' . $p->title . '</a></td>';
echo '<td>' . date('d F Y', $p->date) . '</td>';
echo '<td>' . format_date($p->date) . '</td>';
if (config("views.counter") == "true")
echo '<td>' . $p->views . '</td>';
echo '<td>' . $p->tag . '</td>';

View file

@ -1,7 +1,7 @@
<?php
if (login()) {
if (isset($_GET['file'])) {
$file = $_GET['file'];
$file = _h($_GET['file']);
if (!empty($file)) {
unlink($file);

View file

@ -1,6 +1,6 @@
<?php
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
$destination = _h($_GET['destination']);
}
$url = $p->file;

View file

@ -1,6 +1,6 @@
<?php
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
$destination = _h($_GET['destination']);
}
$url = $p->file;

View file

@ -1,6 +1,6 @@
<?php
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
$destination = _h($_GET['destination']);
}
$url = $p->file;
$oldurl = explode('_', $url);

View file

@ -30,7 +30,7 @@ if (empty($oldtag)) {
$oldmd = str_replace('.md', '', $oldurl[2]);
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
$destination = _h($_GET['destination']);
} else {
$destination = 'admin';
}

View file

@ -41,7 +41,7 @@ if ($type == 'is_frontpage') {
$oldcontent = remove_html_comments($content);
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
$destination = _h($_GET['destination']);
} else {
$destination = 'admin';
}

View file

@ -24,7 +24,7 @@
?>
<tr class="<?php echo $class ?>">
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
<td><?php echo date('d F Y', $p->date) ?></td>
<td><?php echo format_date($p->date) ?></td>
<?php if (config("views.counter") == "true"): ?>
<td><?php echo $p->views ?></td><?php endif; ?>
<td><a target="_blank" href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></td>

View file

@ -24,7 +24,7 @@
?>
<tr class="<?php echo $class ?>">
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
<td><?php echo date('d F Y', $p->date) ?></td>
<td><?php echo format_date($p->date) ?></td>
<?php if (config("views.counter") == "true"): ?>
<td><?php echo $p->views ?></td><?php endif; ?>
<td><a target="_blank" href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></td>

View file

@ -22,7 +22,7 @@
?>
<tr class="<?php echo $class ?>">
<td><?php echo $p->title ?></td>
<td><?php echo date('d F Y', $p->date) ?></td>
<td><?php echo format_date($p->date) ?></td>
<td><?php echo strip_tags($p->tag) ?></td>
<td><a href="<?php echo $p->url ?>/edit?destination=admin/draft"><?php echo i18n('Edit');?></a> <a href="<?php echo $p->url ?>/delete?destination=admin/draft"><?php echo i18n('Delete');?></a></td>
</tr>

View file

@ -25,7 +25,7 @@
?>
<tr class="<?php echo $class ?>">
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
<td><?php echo date('d F Y', $p->date) ?></td>
<td><?php echo format_date($p->date) ?></td>
<?php if (config("views.counter") == "true"): ?>
<td><?php echo $p->views ?></td>
<?php endif; ?>

View file

@ -17,7 +17,7 @@ if (config('timezone')) {
get('/index', function () {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -186,7 +186,7 @@ post('/login', function () {
get('/author/:name', function ($name) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -397,7 +397,7 @@ get('/front/edit', function () {
// Show the "Add content" page
get('/add/content', function () {
$req = $_GET['type'];
$req = _h($_GET['type']);
$type = 'is_' . $req;
@ -1401,7 +1401,7 @@ get('/admin/categories', function () {
get('/category/:category', function ($category) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -1597,7 +1597,7 @@ post('/category/:category/delete', function () {
get('/type/:type', function ($type) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -1666,7 +1666,7 @@ get('/type/:type', function ($type) {
get('/tag/:tag', function ($tag) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -1731,7 +1731,7 @@ get('/tag/:tag', function ($tag) {
get('/archive/:req', function ($req) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -1806,7 +1806,7 @@ get('/archive/:req', function ($req) {
get('/search/:keyword', function ($keyword) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -1904,7 +1904,7 @@ get('/feed/opml', function () {
get('/post/:name', function ($name) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -2288,7 +2288,7 @@ post('/post/:name/delete', function () {
get('/:static', function ($static) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -2683,7 +2683,7 @@ post('/:static/delete', function () {
get('/:static/:sub', function ($static, $sub) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -2890,7 +2890,7 @@ post('/:static/:sub/delete', function () {
get('/:year/:month/:name', function ($year, $month, $name) {
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}

View file

@ -1816,7 +1816,6 @@ function social($imgDir = null)
{
$twitter = config('social.twitter');
$facebook = config('social.facebook');
$google = config('social.google');
$tumblr = config('social.tumblr');
$rss = site_url() . 'feed/rss';
@ -1832,10 +1831,6 @@ function social($imgDir = null)
echo '<a href="' . $facebook . '" target="_blank"><img src="' . site_url() . 'themes/' . $imgDir . 'facebook.png" width="32" height="32" alt="Facebook"/></a>';
}
if (!empty($google)) {
echo '<a href="' . $google . '" target="_blank"><img src="' . site_url() . 'themes/' . $imgDir . 'googleplus.png" width="32" height="32" alt="Google+"/></a>';
}
if (!empty($tumblr)) {
echo '<a href="' . $tumblr . '" target="_blank"><img src="' . site_url() . 'themes/' . $imgDir . 'tumblr.png" width="32" height="32" alt="Tumblr"/></a>';
}
@ -2164,7 +2159,7 @@ EOF;
EOF;
}
if (isset($_GET['search'])) {
$search = $_GET['search'];
$search = _h($_GET['search']);
$url = site_url() . 'search/' . remove_accent($search);
header("Location: $url");
}
@ -3212,7 +3207,7 @@ function get_language()
$langID = config('language');
$langFile = 'lang/'. $langID . '.ini';
$local = strtolower($langID);
$local = $langID;
// Settings for the language
if (!isset($langID) || config('language') === 'en') {