
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
A hack to enable use of libraries that depend on a basic form of eval in Atom
This is a hack to enable third-party libraries that depend on a limited subset
of eval
semantics to work in Atom with a content security policy that forbids
calls to eval
.
{allowUnsafeEval, allowUnsafeNewFunction} = require 'loophole'
allowUnsafeEval ->
crazyLibrary.exploitLoophole() # allows `eval(...)`
allowUnsafeNewFunction ->
crazyLibrary.exploitLoophole() # allows `new Function(...)`
You can also use the exported Function
constructor directly:
{Function} = require 'loophole'
f = new Function("return 1 + 1;")
allowUnsafeEval
replaces eval
with a call to vm.runInThisContext
, which
won't perfectly emulate eval
but is good enough in certain circumstances, like
compiling PEG.js grammars.
allowUnsafeNewFunction
temporarily replaces global.Function
with
loophole.Function
, which passes the source of the desired function to
vm.runInThisContext
.
If there's a loophole, why even enable CSP? It still prevents developers from accidentally invoking eval with legacy libraries. For example, did you know that jQuery runs eval when you pass it content with script tags? If you want eval, you'll need to explicitly ask for it.
FAQs
A hack to enable use of libraries that depend on a basic form of eval in Atom
The npm package loophole receives a total of 12,870 weekly downloads. As such, loophole popularity was classified as popular.
We found that loophole demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.