Skip to content

Commit 30076a0

Browse files
authored
Merge pull request NginxProxyManager#2635 from skarlcf/security/CVE-2023-23596
Mitigate CVE-2023-23596
2 parents 42bd391 + 2ff66ee commit 30076a0

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

backend/internal/access-list.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ const internalAccessList = {
507507
if (typeof item.password !== 'undefined' && item.password.length) {
508508
logger.info('Adding: ' + item.username);
509509

510-
utils.exec('/usr/bin/htpasswd -b "' + htpasswd_file + '" "' + item.username + '" "' + item.password + '"')
510+
utils.execFile('/usr/bin/htpasswd', ['-b', htpasswd_file, item.username, item.password])
511511
.then((/*result*/) => {
512512
next();
513513
})

backend/lib/utils.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const exec = require('child_process').exec;
1+
const exec = require('child_process').exec;
2+
const execFile = require('child_process').execFile;
23

34
module.exports = {
45

@@ -16,5 +17,21 @@ module.exports = {
1617
}
1718
});
1819
});
20+
},
21+
22+
/**
23+
* @param {Array} cmd
24+
* @returns {Promise}
25+
*/
26+
execFile: function (cmd) {
27+
return new Promise((resolve, reject) => {
28+
execFile(cmd, function (err, stdout, /*stderr*/) {
29+
if (err && typeof err === 'object') {
30+
reject(err);
31+
} else {
32+
resolve(stdout.trim());
33+
}
34+
});
35+
});
1936
}
2037
};

0 commit comments

Comments
 (0)