"Black Clouds and Silver Linings in Node.js Security" Liran Tal
The document discusses security vulnerabilities in Node.js, highlighting common risks such as malicious modules and typosquatting attacks. It emphasizes the importance of community awareness and implementing best practices to secure open-source dependencies. Additionally, it outlines various initiatives aimed at improving the overall security landscape of the Node.js ecosystem.
Invites big risksInvitesbig risks
The Biggest RepositoryThe Biggest Repository
Lucrative attack impactLucrative attack impact
8.
Invites big risksInvitesbig risks
The Biggest RepositoryThe Biggest Repository
Lucrative attack impactLucrative attack impact
Open and free-to-publish ecosystemOpen and free-to-publish ecosystem
9.
Invites big risksInvitesbig risks
The Biggest RepositoryThe Biggest Repository
Lucrative attack impactLucrative attack impact
Open and free-to-publish ecosystemOpen and free-to-publish ecosystem
Difficult to counter-measureDifficult to counter-measure
How did wefind out about this maliciousHow did we find out about this malicious
crossenv package?crossenv package?
post-install script ā post-install script ā
call-home base64 payload ā call-home base64 payload ā
Compromised Contributors ?CompromisedContributors ?
662662 usersusers
123456123456
had their password set tohad their password set to
CompromisedCompromised ContributorsContributors ??
49.
Compromised Contributors ?CompromisedContributors ?
14091409 usersusers
had their password set tohad their password set to
their usernametheir username
CompromisedCompromised ContributorsContributors ??
50.
Compromised Contributors ?CompromisedContributors ?
11%11% usersusers
had their password set tohad their password set to
previously leaked passwordpreviously leaked password
CompromisedCompromised ContributorsContributors ??
OWASP Top 10:OWASPTop 10:
Using Components WithUsing Components With
Known VulnerabilitiesKnown Vulnerabilities
58.
who watches afterall thesewho watches after all these
modules ?modules ?
59.
who watches afterall thesewho watches after all these
modules ?modules ?
60.
who watches afterall thesewho watches after all these
modules ?modules ?
61.
0101 The ScaryState of Node.js SecurityThe Scary State of Node.js Security
02Ā 02Ā ||
||
03Ā 03Ā ||
Selected Vulnerabilities in Node.jsSelected Vulnerabilities in Node.js
Silver Linings in Node.js SecuritySilver Linings in Node.js Security
Black Clouds & Silver LiningsBlack Clouds & Silver Linings
in Node.js Securityin Node.js Security
Best Practice:Best Practice:
execFile('git',[...args])execFile('git', [...args])
Maintain a whitelist of allowed argsMaintain a whitelist of allowed args
Blacklist special shell chars like ;Blacklist special shell chars like ;
PrayPray
Command InjectionCommand Injection
Regular ExpressionsRegular Expressions
BestPractice #1Best Practice #1
DO NOT WRITE YOUR OWN REGEXDO NOT WRITE YOUR OWN REGEX
Best Practice #2Best Practice #2
DO NOT WRITE YOUR OWN REGEXDO NOT WRITE YOUR OWN REGEX
Regular ExpressionsRegular Expressions
BestPractice #4Best Practice #4
Safe-RegexSafe-Regex Node.js moduleNode.js module
const safeRegex = require('safe-regex')
let regex = /^(([a-z])+.)+[A-Z]([a-z])+$/
let isSafe = safeRegex(regex)
86.
0101 The ScaryState of Node.js SecurityThe Scary State of Node.js Security
02Ā 02Ā ||
||
03Ā 03Ā ||
Selected Vulnerabilities in Node.jsSelected Vulnerabilities in Node.js
Silver Linings in Node.js SecuritySilver Linings in Node.js Security
Black Clouds & Silver LiningsBlack Clouds & Silver Linings
in Node.js Securityin Node.js Security
87.
The npmjs EcosystemThenpmjs Ecosystem
Silver Linings inSilver Linings in
Node.js SecurityNode.js Security
TakingTaking OwnershipOwnership ofof
YourApp SecurityYour App Security
Source: The State of Open Source Security Report 2019, Snyk
https://snyk.io/opensourcesecurity-2019/