Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
itt: the pgp key that would have been stolen from the user's hard disk by malware is much more secure than the username/password that would have been stolen from the user's hard disk by malware, because pgp key revocation much easier than changing passwords

Adbot
ADBOT LOVES YOU

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
npm and other package managers seem almost expressly set up to expedite supply chain attacks and the culture surrounding them makes it worse. left-pad is an indication of a problem of balkanization and abrogation if responsibility for understanding that supply chain. I don’t know what a better model is but I don’t have to to say that this one isn’t good

Pryor on Fire
May 14, 2013

they don't know all alien abduction experiences can be explained by people thinking saving private ryan was a documentary

Suspicious Dish posted:

please explain to me how this environment is any different from other language package systems like CPAN, PyPI, Maven, Ruby Gems, etc.

Yeah I'm complaining about all of those too, and more broadly about containerization and ops and all the cloud buttons that try to make everything easy by downloading a hundred unsigned untrusted binaries from some 3rd party.

It's all quite bizarre.

James Baud
May 24, 2015

by LITERALLY AN ADMIN
e: (wrong thread)

Shaggar
Apr 26, 2006

Suspicious Dish posted:

please explain to me how this environment is any different from other language package systems like CPAN, PyPI, Maven, Ruby Gems, etc.

maven has artifact signing and also jars can be signed.

Shaggar
Apr 26, 2006

Suspicious Dish posted:

itt: the pgp key that would have been stolen from the user's hard disk by malware is much more secure than the username/password that would have been stolen from the user's hard disk by malware, because pgp key revocation much easier than changing passwords

its not about trust of the package generator, its about trust of the package repository. its message security vs transport security. message security (package signing) lets me ignore where I get my package. I don't give a poo poo about the package source as long as the message is intact.

If I trust Microsoft to secure their signing keys, I can trust where a Microsoft package came from regardless of source. If Microsoft is just uploading stuff to GitHub unsigned, im putting my faith in GitHub that they, not Microsoft, are doing things correctly. I mean now GitHub is owned by Microsoft sure but I trust ms for security way more than I trust the GitHub fedora bros.

Shaggar
Apr 26, 2006
also its not at all surprising javascript devs don't understand security.

Shaggar
Apr 26, 2006
even powershell scripts can be signed, even if they typically aren't because of the poor design decision not to enforce it.

Plank Walker
Aug 11, 2005

Suspicious Dish posted:

please explain to me how this environment is any different from other language package systems like CPAN, PyPI, Maven, Ruby Gems, etc.

what is the perl/python/java/etc equivalent of eslint?

Phone
Jul 30, 2005

親子丼をほしい。
did powershell 3 fix the whole "you have to give yourself permaroot in order to execute stuff" garbage?

Plank Walker
Aug 11, 2005
this eslint exploit only targeted dev machines right?

if someone published a malicious minifier/transpiler version, would they be able to inject malicious code into any project that relied on those tools?

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Plank Walker posted:

this eslint exploit only targeted dev machines right?

if someone published a malicious minifier/transpiler version, would they be able to inject malicious code into any project that relied on those tools?

dev machines or really any other machine running npm stuff (so, prod servers lol)

💯 on the trusting trust attack

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

mrmcd posted:

I'm Xenu's Link Sleuth 1.1c

I'm Flaming AttackBot

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Shaggar posted:

its not about trust of the package generator, its about trust of the package repository. its message security vs transport security. message security (package signing) lets me ignore where I get my package. I don't give a poo poo about the package source as long as the message is intact.

If I trust Microsoft to secure their signing keys, I can trust where a Microsoft package came from regardless of source. If Microsoft is just uploading stuff to GitHub unsigned, im putting my faith in GitHub that they, not Microsoft, are doing things correctly. I mean now GitHub is owned by Microsoft sure but I trust ms for security way more than I trust the GitHub fedora bros.

ok so now your malware-filled eslint zip file is signed as coming from the eslint developers. this helps you exactly... how?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Plank Walker posted:

what is the perl/python/java/etc equivalent of eslint?

by this you mean "a common enough perl/python/java package that a lot of things will install it"? how about log4j or python's flask/django

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Suspicious Dish posted:

ok so now your malware-filled eslint zip file is signed as coming from the eslint developers. this helps you exactly... how?

don’t bother, he’s not worth the typing

fisting by many
Dec 25, 2009



*has publish access to a package that is downloaded 2.5 million times a week*

quote:

The maintainer whose account was compromised had reused their npm password on several other sites and did not have two-factor authentication enabled on their npm account.

fisting by many
Dec 25, 2009



if computers weren't involved that would be criminal negligence

Shaggar
Apr 26, 2006

Phone posted:

did powershell 3 fix the whole "you have to give yourself permaroot in order to execute stuff" garbage?

no because it was never a thing

Shaggar
Apr 26, 2006

Suspicious Dish posted:

ok so now your malware-filled eslint zip file is signed as coming from the eslint developers. this helps you exactly... how?

it doesn't. what it prevents is the scenario where they upload it for distribution and the distributor gets owned. Or the scenario where the artifact is distributed by someone else as in an artifact proxy repo.

do you really not understand code signing?

Shaggar
Apr 26, 2006

fisting by many posted:

*has publish access to a package that is downloaded 2.5 million times a week*


but wahhhh I don't want to sign packages even though it would have prevented this because im a lazy lovely javascript developer who uses bad tools and thinks that's how it has to work for everyone

Shaggar
Apr 26, 2006

Cocoa Crispies posted:

don’t bother, he’s not worth the typing

lol Linux users continuing this threads tradition of ignoring security because they're always wrong.

Slanderer
May 6, 2007

flakeloaf posted:

at least a usb port with a yubikey in it isn't going to be used to charge somebody's loving phone

how dare they

Shaggar
Apr 26, 2006
javascript developer: lets not use tls because it doesn't protect you from the server getting owned.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Shaggar posted:

it doesn't. what it prevents is the scenario where they upload it for distribution and the distributor gets owned. Or the scenario where the artifact is distributed by someone else as in an artifact proxy repo.

do you really not understand code signing?

ok, so it has no bearing on anything that happened today and wouldn't have fixed this issue.

Shaggar posted:

but wahhhh I don't want to sign packages even though it would have prevented this because im a lazy lovely javascript developer who uses bad tools and thinks that's how it has to work for everyone

but you just said it wouldn't have prevented this

Shaggar
Apr 26, 2006
it would have prevented that attack since it was on the distributor, not the package generation. Someone broke into the npm account, not the developer's build environment, and uploaded a bad version of eslint that would have had no signature or an invalid signature. From there properly setup environments would reject it and prevent the exploit from executing on people dependent on eslint.

it wouldn't prevent it in the event that the eslint build environment was compromised and the signing key was stolen, but that's not what happened here.

Shaggar fucked around with this message at 05:38 on Jul 13, 2018

Shaggar
Apr 26, 2006
also in the event of key theft they could add it to its related crl so future use of the file would be prevented. Right now since there is no signing the invalid version is out in the wild forever and someone might reuse it from a local copy without realizing its tainted.

Phone
Jul 30, 2005

親子丼をほしい。

Shaggar posted:

no because it was never a thing

i haven't looked at the man Get-Help Verb-Noun in ages, but there's no way to temporarily run things as admin in powershell because the execution policy by default is set to restricted right? you can't do whatever the equivalent of "sudo foo.ps1" in powershell because its locked down?

Shaggar
Apr 26, 2006
if you want to run things as admin you run powershell as administrator like you would any other application.

you're probably thinking of the execution policy which by default prevents you from running downloaded unsigned scripts. This is to prevent the most obvious attacks. It does not prevent you from running local scripts or remote scripts that you have unblocked. This works by looking for a flag on the file that's set when you download a file. Its not perfect but again it prevents you from doing something stupid without atleast giving it some effort.

If you want to run a script you downloaded you can: A) unblock the file by removing the download flag B) sign the file yourself C) set the execution policy to something less restrictive. A and B are the correct options since they are per file. C is bad cause it removes that downloaded script protection for any future script you run. C also requires that you run the set-executionpolicy command as administrator like you would expect when changing system/security settings. You can also set it per user or per machine. Never ever change the machine setting like god drat please don't just learn to sign your scripts its not hard.

Shaggar
Apr 26, 2006
Also you can set the execution policy to only allow signed scripts to run. that's a great idea. but the problem is a lot of core powershell modules from Microsoft aren't signed so it means they wont run. its stupid. they should have just made the default machine policy signed only, signed all the Microsoft modules, and then required you to set your user policy separately to run your own scripts.

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Phone posted:

i haven't looked at the man Get-Help Verb-Noun in ages, but there's no way to temporarily run things as admin in powershell because the execution policy by default is set to restricted right? you can't do whatever the equivalent of "sudo foo.ps1" in powershell because its locked down?

windows processes can't elevate while running

in theory they could make a "sudo" command that would spawn a new elevated powershell process that would run whatever ps command was typed in after it

redleader
Aug 18, 2005

Engage according to operational parameters
explain why the default execution policy (restricted, disallowing all scripts including ones you have written) is a sensible default for the new windows scripting language

imo restricted is a bad default, because the first thing everyone does when trying to save and run a script is google the error, learn about execution policies, and disable them entirely. if the default was RemoteSigned, most people wouldn't even notice

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


yeah script signing in PowerShell is a perfect demonstration of a good idea wrt security but implemented so badly it has the opposite effect because

quote:

the first thing everyone does when trying to save and run a script is google the error, learn about execution policies, and disable them entirely.


it's me (though I haven't touched ps for ages)

spankmeister
Jun 15, 2008






In the default config you can disable the execution policy as a command line option to the script you're executing

Pile Of Garbage
May 28, 2007



redleader posted:

explain why the default execution policy (restricted, disallowing all scripts including ones you have written) is a sensible default for the new windows scripting language

imo restricted is a bad default, because the first thing everyone does when trying to save and run a script is google the error, learn about execution policies, and disable them entirely. if the default was RemoteSigned, most people wouldn't even notice

because the very large majority of windows users will never launch powershell.exe let alone execute a powershell script so disabling untrusted script execution is a nice mitigation feature. for those who do want to run scripts they can just go and change it. in managed environments execution policy is usually set via group policy.

Powerful Two-Hander posted:

yeah script signing in PowerShell is a perfect demonstration of a good idea wrt security but implemented so badly it has the opposite effect because

script signing is an excellent feature which is simply underutilised. this whole situation with execution policy is very analogous to when UAC was first implemented: initially poo poo because no one did things properly however when people did start doing things properly it became a non-issue.

tbh i'm just glad that microsoft had the foresight to bake signing in from the beginning as an option. it's a nice feature that's good to have.

of course as others have pointed out execution policy is pretty much moot because you can just pull a payload from the web (using Invoke-WebRequest or System.Net.Sockets.TcpClient) and execute it with Invoke-Expression within the shell. this can be mitigated ofc. in the last place i was at we configured the SEP client firewall (yeah yeah i know) to block network connections from powershell.exe except to specific internal trusted hosts.

Optimus_Rhyme
Apr 15, 2007

are you that mainframe hacker guy?

Phobeste posted:

npm and other package managers seem almost expressly set up to expedite supply chain attacks and the culture surrounding them makes it worse. left-pad is an indication of a problem of balkanization and abrogation if responsibility for understanding that supply chain. I don’t know what a better model is but I don’t have to to say that this one isn’t good

Same but gentoo

Shaggar
Apr 26, 2006

redleader posted:

explain why the default execution policy (restricted, disallowing all scripts including ones you have written) is a sensible default for the new windows scripting language

imo restricted is a bad default, because the first thing everyone does when trying to save and run a script is google the error, learn about execution policies, and disable them entirely. if the default was RemoteSigned, most people wouldn't even notice

it doesn't restrict ones you have written.

Shaggar
Apr 26, 2006

spankmeister posted:

In the default config you can disable the execution policy as a command line option to the script you're executing

it requires admin privileges though so at that point you already have total access to the machine.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug
what if like crates/gems/eggs/etc. could declare and have enforced limited permissions

like if I did npm install left-pad node would grab the package metadata, see that it claims to be pure, puts that in the node-modules.json file, and from then on, even if left-pad gets sold to a capitalist and updated to be malware, if it does something that's not pure function behavior (pulls in file or network I/o stuff, etc.) the process gets killed

so if there's a really compelling left-pad feature that renders it non-pure you have to go in and remove the pure annotation from node-modules, but even through updates it won't ever disappear on its own

think pledge in bsd but for a platform people use and instead of a process lifetime (seconds to hours) it's a package lifetime (months to years ideally)

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006
I don't think javascript is good enough to be able to enforce that reliably. it would be too easy to obfuscate in code and you'd have to rely on runtime enforcement which would be totally out of the developer's hands.

plus non-malware authors could have legitimate reasons to change it in the future which would cause your poo poo to break. A better option would be like windows store and ios/android apps do where the application metadata requests certain privileges and the user allows or denies them. Then the runtime enforces the security.

You could then push this all the way to the browser and users could start deciding if they want to let goog-analytics.js access all their poo poo.

  • Locked thread