Skip to content

Commit de16238

Browse files
committed
Fixed again a critical bug with path travel...
1 parent f1e94c1 commit de16238

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7387,9 +7387,13 @@ F.$requestcontinue = function(req, res, headers) {
73877387

73887388
// Stops path travelsation outside of "public" directory
73897389
// A potential security issue
7390-
if (req.uri.pathname.indexOf('./') !== -1) {
7391-
req.$total_status(404);
7392-
return;
7390+
for (var i = 0; i < req.uri.pathname.length; i++) {
7391+
var c = req.uri.pathname[i];
7392+
var n = req.uri.pathname[i + 1];
7393+
if ((c === '.' && n === '/') || (c === '%' && n === '2' && req.uri.pathname[i + 2] === 'e')) {
7394+
req.$total_status(404);
7395+
return;
7396+
}
73937397
}
73947398

73957399
F.stats.request.file++;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"name": "Sarp Aykent",
100100
"email": "[email protected]"
101101
}],
102-
"version": "3.2.2",
102+
"version": "3.2.3",
103103
"homepage": "http://www.totaljs.com",
104104
"bugs": {
105105
"url": "https://github.com/totaljs/framework/issues",

0 commit comments

Comments
 (0)