Malware analysis at runtime
@naugtur, Confidence 2024
[](https://www.ted.com/talks/clifford_stoll_the_call_to_learn?utm_campaign=tedspread&utm_medium=referral&utm_source=tedcomshare)
It's going to be a bit like this TED talk by Clifford Stoll
Put your malicious code in a package and people will gobble it up like cookies.
Supply chain attack
delivery
postinstall
typo squatting
dependency confusion
package takeover
prototype poisoning
🙈
BTW
Don't publish malware to NPM please
Hello, we've found a malicious package version
in your dependencies that…
you've been shipping to production for a week.
- npm audit
This new package looks odd. Got time to read it?
- socket.dev
There's a fix for this vulnerability but you're many versions behind. Want a custom patch?
- seal.security
# 🪄
### Delivering attacks to logic you're not involved with
## Prototype poisoning
# 🧪🍏
![]()
```js
const a = {};
Object.prototype.toString = ()=>'👻';
console.log(`scary object: ${a}`);
```
```
scary object: 👻
```
### JS can be tweaked and it's no accident
- designed in 10 days
- humbly assuming there's room for improvement
## polyfills
#### and
## prototype poisoning
#### are the same thing
#### with different intentions
## attack examples
# ☠️
repo:[js-training-examples -> defensive coding](https://github.com/naugtur/js-training-examples)
> See attacks 2, 4, 5, 7
we could work side-by-side