Skip to content

Commit 28813cd

Browse files
committed
XSS flaw correction
With a client IE < 10 there was a XSS security flaw. Other browsers were not affected. Also corrected spacing display with IE<10.
1 parent 772fcb6 commit 28813cd

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,7 @@
6363
* ADDED: Better json checking (including entropy).
6464
* ADDED: Added version to js/css assets URLs in order to prevent some abusive caches to serve an obsolete version of these files when ZeroBin is upgraded.
6565
* "Burn after reading" option has been moved out of Expiration combo to a separate checkbox. Reason is: You can prevent a read-once paste to be available ad vitam eternam on the net.
66-
66+
* **Alpha 0.19 (2013-07-05)**:
67+
* Corrected XSS security flaw which affected IE<10. Other browsers were not affected.
68+
* Corrected spacing display in IE<10.
6769

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ZeroBin 0.18 Alpha
1+
ZeroBin 0.19 Alpha
22

33
==== THIS IS ALPHA SOFTWARE - USE AT YOUR OWN RISKS ====
44

css/zerobin.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* ZeroBin 0.18 - http://sebsauvage.net/wiki/doku.php?id=php:zerobin */
1+
/* ZeroBin 0.19 - http://sebsauvage.net/wiki/doku.php?id=php:zerobin */
22

33

44
/* CSS Reset from YUI 3.4.1 (build 4118) - Copyright 2011 Yahoo! Inc. All rights reserved.

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ZeroBin - a zero-knowledge paste bin
44
Please see project page: http://sebsauvage.net/wiki/doku.php?id=php:zerobin
55
*/
6-
$VERSION='Alpha 0.18';
6+
$VERSION='Alpha 0.19';
77
if (version_compare(PHP_VERSION, '5.2.6') < 0) die('ZeroBin requires php 5.2.6 or above to work. Sorry.');
88
require_once "lib/serversalt.php";
99
require_once "lib/vizhash_gd_zero.php";

js/zerobin.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* ZeroBin 0.18
2+
* ZeroBin 0.19
33
*
44
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
55
* @author sebsauvage
@@ -147,6 +147,9 @@ function pasteID() {
147147
return window.location.search.substring(1);
148148
}
149149

150+
function htmlEntities(str) {
151+
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
152+
}
150153
/**
151154
* Set text of a DOM element (required for IE)
152155
* This is equivalent to element.text(text)
@@ -157,8 +160,8 @@ function setElementText(element, text) {
157160
// For IE<10.
158161
if ($('div#oldienotice').is(":visible")) {
159162
// IE<10 does not support white-space:pre-wrap; so we have to do this BIG UGLY STINKING THING.
160-
element.text(text.replace(/\n/ig,'{BIG_UGLY_STINKING_THING__OH_GOD_I_HATE_IE}'));
161-
element.html(element.text().replace(/{BIG_UGLY_STINKING_THING__OH_GOD_I_HATE_IE}/ig,"\r\n<br>"));
163+
var html = htmlEntities(text).replace(/\n/ig,"\r\n<br>");
164+
element.html('<pre>'+html+'</pre>');
162165
}
163166
// for other (sane) browsers:
164167
else {

lib/vizhash_gd_zero.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
// VizHash_GD 0.0.4 beta ZeroBin 0.18
2+
// VizHash_GD 0.0.4 beta ZeroBin 0.19
33
// Visual Hash implementation in php4+GD, stripped down and modified version for ZeroBin
44
// See: http://sebsauvage.net/wiki/doku.php?id=php:vizhash_gd
55
// This is free software under the zlib/libpng licence

0 commit comments

Comments
 (0)