From 95290db5d7720b68bca6719b96192c1528d96555 Mon Sep 17 00:00:00 2001 From: Asjid Kalam Date: Wed, 9 Sep 2020 16:10:08 +0530 Subject: [PATCH 1/2] Fixed path traversal bug --- webrepl.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webrepl.js b/webrepl.js index ab03ced..ba2c50a 100644 --- a/webrepl.js +++ b/webrepl.js @@ -79,6 +79,12 @@ ReplHttpServer.prototype.start = function(port) { ReplHttpServer.prototype.route = function(req, res) { var stream = this.stream; var replServer = this.replServer; + + if(req.url.includes('../')){ + console.log("Error resolving context request: " + req.url); + res.writeHeader(500); + res.end(); + } req.on('error', function() { /* Ignore Errors */ }); res.on('error', function() { /* Ignore Errors */ }); From 8dfeff5559b0757b965c67c3a2604cf5917c57a8 Mon Sep 17 00:00:00 2001 From: Asjid Kalam Date: Wed, 9 Sep 2020 18:22:44 +0530 Subject: [PATCH 2/2] updated fix --- webrepl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrepl.js b/webrepl.js index ba2c50a..7b5a103 100644 --- a/webrepl.js +++ b/webrepl.js @@ -80,7 +80,7 @@ ReplHttpServer.prototype.route = function(req, res) { var stream = this.stream; var replServer = this.replServer; - if(req.url.includes('../')){ + if(req.url.includes('..')){ console.log("Error resolving context request: " + req.url); res.writeHeader(500); res.end();