229 points · by sysoleg · 5y ago · 256 comments
Ex:
- do not run on any event.. unless user authorized for that event. Same for actions.
- separate out policies and users cannot edit policies unless authorized to do that
- do not get physical/logical resources (runners, disk quota, long runs, ...) unless given
- default-deny network outbound with url safe-listing
That way only trusted users can run them, and a bit harder for them to get hurt when there is a surprising action that they run
The next level would probably be something like sandboxing : allow anyone to run an action , but a sandbox mode can autofail if violated, and have explicit imports/exports to lock down for how it gets used.
A lot possible.. but need to invest in the basics first..
Unfortunately, using self-hosted runners to provide additional capabilities not supported by Github-hosted ones is basically impossible (for public repos at least) as you can't restrict a runner to an organization or project. Set up a bare-metal runner and it will receive jobs from random forks.
Only if you've configured the actions correctly. I would bet that there is a high number of repositories on both GitLab and GitHub with misconfigured CI pipelines where someone can submit a PR with `env | curl` to grab any secrets defined as environment variables.
If so, I wonder if there is a legit need for running modified GitHub actions from non-collaborators?
Could also subject modified actions coming in via pull requests (from non-collaborators) to heavy resources constraints and timeouts.
The attack vector in the article is not the main way miners try to steal CPU from the GitHub community. It's just an interesting one that the journalist chose to write about.
IIRC, they already treat the .github folder as a special case; you can't push modifications to workflow files with a personal access token. So why not ensure that an action or workflow will only run if it is checked into the base branch?
That wouldn't stop PRs from modifying scripts that the action runs, but the current behavior seems a bit counter-intuitive.
from Microsoft*
Could temporarily reduce the population of abusers while we figure out a more sustainable strategy?
This speculation is making some people rich, yes. But the amount of externalities is staggering.
Thanks to PoW nobody can provide a free compute anymore without getting owned, and of course the environmental impact of bitcoin alone is worse than when Saddam Hussein set oil wells on fire while retreating.
Let the world burn, and products rot to shit, as long as my HODL portfolio goes up. Cryptocurrency supporters really are sociopaths, worse than any hedge fund manager.
But seeing the HW situation, energy burn, scammers, infra hijacking, etc. there are so many negatives I'm more and more in favour of making it illegal.
Just realize what you're asking for.
Meanwhile the rest of us get stuck with externalities - huge energy consumption, hardware supply disruptions, hardware waste, compute hijacking, enabling scammers and extortions schemes.
I don't think crypto should be illegal but the institutions enabling it should
I feel the same about PoN[1]-based currencies! Get rid of the Fed and the military!
[1] Proof of nukes.
Crypto / blockchain is great, its current implementation is very much lacking.
I realize what I'm asking for. I'm asking for cryptocurrency speculators to actually pay for the externalities they cause.
Because that's the core of the libertarianism they pretend to support. But of course they don't have libertarian values. The only ideal they stand for is them getting richer by burning everyone else to the ground.
Why? They pay for electricity like everyone else, excepting cases where they're already breaking laws.
Just a thought, I'm probably overlooking something.
Proof of work systems, which by design compete on wasting resources, need to internationally outlawed.
If people want cryptocurrencies to keep going, they can get a move on finally fucking migrating to these alternatives systems they tell us are just around the corner. If none of the major networks are able to do so, they shouldn't exist.
If there is a regulatory route towards reducing / eliminating crypto, I would hope that involves restrictions on the fiat / crypto interchange, not restrictions on what kind of math you can do with a computer.
Sadly scammers follow both new and old tech and it takes a while for measure to catch up. That's not necessarily a fault of the tech itself.
I have seen no proof that it solves anything the proponents have been touting for 5+ years now - just examples of increases in negative externalities.
Using money online has an obvious utility.
"There are financial primitives that cannot exist in traditional finance that I'd call pretty novel. For example flash loans allow uncollateralized loans for millions of dollars[0]. Or take KeeperDAO[1] or Dai[2] or any of the other meta protocols generating returns by providing utility. Also the sheer fact that this is all decentralized/identity-less is already a novel aspect.
[0] https://aave.com/flash-loans/
[1] https://medium.com/keeperdao/a-keepers-guide-to-arbitrage-mi...
Donations to people where paypal doesn’t work are also easier.
Those are the only uses cases (for me) I encountered and used though ;)
When countries descend into chaos or go full on authoritarian the best option is often to leave, but there might already be capital controls. So what can you take with you? Stocks: good luck if held by a broker in the country. Physical gold or cash: good luck at the border/customs. Foreign accounts: hard to come by for most people even in the first world due to regulations. Any serious amount of money is very hard to move between jurisdictions, especially in times of crisis, through traditional means.
If you believe your host country doesn't own you and you should be able to relocate to wherever you are treated best, Bitcoin can be a good tool if you were unprepared so far (e.g. because you didn't think a crisis could hit _your_ country). This might not be a use case for you today, especially if you are happy with your country and it is stable. But don't discount that the situation of others might differ.
From the whitepaper:
Loosely speaking, the PoST consists of two phases: an initialization phase (executed once), in which miners “commit” to the data that fills the space S , and an execution phase (executed repeatedly), in which miners prove that they are still storing the data. The time component of the spacetime resource is the elapsed time between successive proofs—if the interval between initialization (or the previous execution phase) and the latest execution phase is T, this proves the miner expended S · T spacetime.
https://drive.google.com/file/d/18I9GPebWqgpvusI1kMnAB9nayBb...
The whole idea of creating artificial digital scarcity by basing it on physical scarcity of resources is just horrible.
GitHub provides computing resources, for free, to attract users. This is just one of the challenges of that business model. If this is intolerable for GitHub then it's up to them to find a strategy to counter it.
We don't need to ask the government to punish everyone participating in cryptocurrency.
Perhaps we should consider higher-order consequences of doing absolutely nothing. Hypothetically, what happens if free-to-use code collaboration tools are forced out of the market due to rampant abuse and zero regulation? Do we care that there is now a higher barrier of entry to engage in the craft?
Do you want GitHub to start requiring state-issued identification for creating new accounts? That is where this cat-mouse game is going to end up if you allow it to continue naturally.
Don't imagine that GitHub cares about lowering barriers to entry as an end in itself.
It does this as a means to pursue GitHub's business interests.
With credit systems we can have progressive rates i.e food can be a priority while VR and cryto can subsidize carbon neutral transition.
It may be thin, but it covers most people. Most crypto buyers use fiat exchanges. If those were ruled out, the monetary value of tokens would go down, and with it the mining incentives would lower. It wouldn't be the end of crypto, but it would alleviate many issues (energy, hardware shortage, etc).
PS: I don't think crypto is the only reason for GPU shortage (others being more demand from stay-at-home people, and general semiconductor shortages), but I believe it plays a part.
Gamers in western countries have to pay slightly higher prices for their high end gaming GPUs. Excuse me while I clutch my pearls!
The cavalier attitude people have about this tech is really disheartening to see.
Then why are only GPUs unavailable?
We can still easily buy CPUs, memory, SSDs, etc.
You’re not wrong, Walter.
What is cash? Paper? Ink? Currency isn't defined by what it's made of.
> there just happen to be transactions on a distributed network, with some people knowing private keys to generate new transactions
Transactions in which digital tokens are exchanged for goods, services, or other currencies, and the recipient of the tokens generally receives no benefit other than the ability to trade those tokens again.
Cryptocurrencies are recognizable by the way they are used.
I have long maintained that cryptocurrencies aren't property: they're speech.
As others said, the answer here is Proof of Stake, not banning crypto outright.
Is it that they are global and decentralized that made them just not take a stance on them, also the same reason it obviously would easily and quickly gain popularity as a global, decentralized MLM-Ponzi structure?
Making something illegal won't stop it from happening. Just because tech can be used for bad purposes doesn't mean you have to or will have any effectiveness in banning it. See encryption.
It's such a lazy take, ignores the freedom aspect and goes for convenience and feels like a concern troll, honestly.
But in the case of cryptocurrency, putting impediments in the way of exchanging it back and forwards with 'fiat' would significantly impact its appeal and demand. Could they stop it entirely? Probably not. Would it stop most people who only care about the easy profit potential and don't care about the idealogy? Probably.
Detecting them while they are running would be the best approach I guess. Not after the time limit when the damage is already done.
The trick to protections like this is to not tell anyone how they work, and to run them only occasionally. Ie. once a week, ban half of users who are running xmrig.exe. Also include users who signed up with the same email address, phone number or IP address as the detected users and who have a consistently high CPU use - these are probably successful bypasses of your simple process name based filter.
That way bad actors have a very hard time figuring out exactly what your protections are or how they work. If they were to get an immediate ban as soon as they fired up xmrig.exe, then they'd quickly think to rename it or recompile it or run it under wine or a host of other ideas. Yet having a random selection of their accounts banned seemingly at random means they learn nothing.
Obviously you need a process for users accidentally caught in the net to get their accounts reactivated, and if you're a service like githuib you should probably let the user have a grace period to do that before killing their entire business...
Most of build actions is not 100% CPU bound
But yeah, abusers are going to abuse
Unless you compile large C/C++ projects on a low core count VM.
GH Action have a timeout of 60min already. A PR with about 5 jobs running for 5 hrs is nothing to gain for the culprit. The repo owner certainly finds out soon enough, and reports it at GitHub to block him. GitHub doesn't even need to start a mass scan for such losers. Azure is such a huge server farm, nobody should care about a few 1hr miners, who get eventually thrown out.
But the easiest mitigation would be up block outbound traffic to the miners IPs. These are well-known.
What makes it worse is that a tax, higher energy or hardware costs, or increased transaction fees only speed up crypotocurrency inflation relative to other currencies. It's hard for me to comprehend, that others don't see the pyramid scheme behind it.
That means network has to pay less in block reward under PoS, so inflation drops to 1% or less.
Eip-1559 upgrade this summer will also start "burning" a portion of fees. Estimates have this around 0.5% - 1.5% deflation.
Combine those features together, and Ethereum should have long term issuance at around 0% indefinitely, while still paying for validators to secure it.
It's a feedback mechanism too... If usage goes down, burn drops, supply inflates slightly, stimulating use, increasing burn again.
The idea is to make an elastic self-securing system.
I don't understand where the pyramid scheme is in that... The money being paid out to validators will by nature barely cover costs (otherwise more people will validate, reducing margins to match). Since anyone can join, and the network punishes correlated misbehavior, that incentivizes decentralization and wide disbursement of block rewards.
---
In the case of topic here, spare CPU cycles will no longer be valuable to exploit under PoS. The valuble qualities will be availability and uptime... Which won't be had by exploring in-broswer mining scripts, or CI exploits.
I have my objections to crypto currencies, but this is not one of them. Most everything we do as humans is a 'waste' if you want to get philosophical.
Blockchain is an interesting technology. It may or may not go anywhere, but there is value in thousands of people 'playing' with it to see what's possible. That is, there is value in exploring the solution space of the Blockchain because there is possibility in finding some local or global efficiency minima. Think of it as a R&D investment that may or may not pay off. Still too early to tell.
Besides, the energy cost of the Blockchains is not and will not be the determining factor in fight against climate change or any other environmental concern. So the last thing you want is government bureaucracies cracking down on it from that angle. Let people explore and play and see where it goes.
Having said that, if crypto mining does start to impact other infrastructure, regulators may have to look at it. And there's precedent for that kind of action. For example, regulators will typically work against silver speculation because silver is also an industrial product and if the price inflates to much, it will have deleterious effects on other industries and the wider economy.
>It's hard for me to comprehend, that others don't see the pyramid scheme behind it.
There is that aspect of it and most recognize it. When crypto intersects money and acts as an investment, it should be regulated because there are a lot of nefarious individuals who are using crypto currencies to swindle money from people. For example, my next door neighbor tried to enlist me to buy into some crypto scheme recently. It took me 5 mins of googling around to see how incredibly risky that 'sure-bet' is [1]. I'm pretty sure he sunk tens of thousands of his money into it and I'm pretty sure he doesn't quite understand what it is that these scammers are offering him (basically he's trading in crypto, that he had to buy, that is popular and therefore relatively liquid - i.e. something you can actually sell - for crypto that is not and has a good chance of collapsing in the near to mid future). Regulations will help in this area.
[1]https://behindmlm.com/mlm-reviews/hypercapital-review-hyperc...
As others have pointed out, there is a lot of waste everywhere. If I lived further up north, I would certainly take advantage of using a compute cluster to heat my house while also generating cash. Yes, there are more efficient ways to heat a house other than 100% electricity, but it is still quite common.
But the point is, although it uses energy, it makes you money as well. And there are plenty of other such similar things. Take the financial markets for instance. It seems prior to 1980, if you wanted to create "wealth", you kind of actually had to do something. You know like found a company, invent something, claim a patent, etc. Since Greenspan cut interest rates in the 1980s, all efforts have gone into hedging against the stock market.
Outside of semi-conductors, very little tech has been invented for a few decades now. Instead, a ton of manpower (and energy) has gone into inventing financial devices to the point where house mortgages end up being sold five or six times through various lenders until they end up in a pool of mortgages that one would buy slices of. And if you were worried about risk, you could then buy "insurance" to hedge against your slices in either direction. I mean that took a lot of energy, and I'm not sure what society got out of it... Of course there is more regulation now, but still, new ETFs are made every month to fit some niche, and stock options and calls... So in other words, we've spent the last 30 years not really inventing anything but just passing a giant ball of money around through various devices.
Edit: and yes I am completely unqualified to make any of these claims. They are opinion, but they seem awfully close to reality.
This is why we can't have nice things.
Mining is one vector of abuse but there are many others when you’re giving free compute to the world. Especially in the radically open way we’re doing it at Replit.
This is inevitable, and I'm sure every CI system has faced this issue.
Very, most explicitly mention mining and an accurate description of it
But its funny because ToS is not a deterrent and I thought you were being sarcastic, instead of inquisitive
Also, edits to the CI script could be made suspect. I never had a first-time contributor on my projects start by making changes to the CI pipeline.
I am pretty sure smart folks at GH thought of this and just deliberating whether to introduce such a breaking flow to maintainers.
What's to stop attackers from making a one-off harmless edit ("forgot a comma in readme") and then, once they're whitelisted, deploying a malicious executable to the CI pipeline.
I think the root issue is that people without write access to your repo can queue arbitrary compute on your dime by simply creating a PR and changing the GitHub workflow files (the definition for GitHub actions). This is even a bigger issue for companies with self-hosted runners who can't use those for public repos as an attacker could file a PR with malicious code and compromise a machine (https://docs.github.com/en/actions/hosting-your-own-runners/...)
One possible solution here is that a maintainer needs to okay any change that changes a workflow file before it runs. Not sure if that introduces other problems...
I see the advantages of having CI configuration right next to the code, but once you start deploying multiple branches or accepting outside contributors, the downsides start to outweigh the benefits.
In-band signaling is always bad
The more apparent problem is that CI jobs can execute arbitrary code and are not limited wrt. their execution time. If limited, it would render them useless when used for cryptomining.
That's not going to work! You want to make sure all the tests that run as part of the CI pass before you merge. What you can do is to make a blanket ban on auto-running the CI pipeline if the CI config was changed till the maintainer clicks Run Actions.
This simple rule change would defeat the purpose of running CI CD on external contributions: I want to see if the tests run and everything is up to my quality standards. I don't want to manually trigger the pipeline, that adds around 5 minute to every PR I receive...
However, as an attacker, I can still execute anything I want. Sure, maybe it's not as convenient as replacing the yml file, but I could embed a script in the tests that will just mine as long as possible.
The point is that you didn't solve anything, you just ruined CI CD
Until it is default-deny for ~all capabilities with say RBAC for enabling, which are basic security principles, they're pretty scary for public repos. It's even scary for private ones as you might want say a contractor or intern to be limited. That they have people publicly dedicated to whackamole response, but seemingly not to security fundamentals (or if they do, not following them / empowered to), is frustrating. Look at the GHA permissions panel and then think like an attacker or defender, it's scary.
The environment variable stuff awhile back was understandable.. but not the big issue. As basically any user can submit a PR that can make current actions that run code (ex: run tests) to run something else by editing the action or code, that means any public user can burn repo $, play in repo-exposed runners (ex: get into corp sandboxes), and if using continuous deployment or service integrations , into their production systems, wherever they publish packages, etc. GitHub is api exposed and git can have commits deleted, so they can even cover most of their tracks. This is SolarWinds all over again, but now a bot can run it automatically on ~everyone!
GHA is both one of my favorite things about GitHub but also been scary. Maybe now that they have access to some. of the best security engineers and researchers in the world, they can fix this...
"Secrets are not passed to workflows that are triggered by a pull request from a fork."
If just CPU’s that’s gotta be such a gigantic waste of CPU power for such little crypto.
"GitHub hosts Linux and Windows runners on Standard_DS2_v2 [1] virtual machines in Microsoft Azure"
The only way to have access to a GPU is to use your own self-hosted runner.
0 - https://docs.github.com/en/actions/using-github-hosted-runne...
1 - https://docs.microsoft.com/en-us/azure/virtual-machines/dv2-...
I think if half the effort spent here was spent learning finance, the bad actors would have more money.
Hope they manage to sort it out - and also hope these arseholes doing the damage don't ruin GitHub Actions for the rest of us.
[0] in a discussion about the dangers of running your own CI server. I thought it were sensible if there was a permission config file which specified who can trigger which actions, where the CI uses the permissions of the last ran commit.
It's really strange to me. You would think anyone offering free anything on the internet knows there are people out there who will automate abusing your compute, storage, IPs, any resources you leave exposed.
I've seen someone abuse a password reset form cuz they could advertise using that email addr '+' trick. (realuser+buy_our_scam@example.com). On a platform that didn't even have a million users. If it's free resources, there's no scam too unlikely.
However, it turns out — who would have guessed — people do want to build random PRs, because 99% of PRs aren't jerks trying to mine crypto.
---
Edit: To expand on the 'pull_request_target' event, it was introduced later and defends against running arbitrary unsanctioned workflows. It could have been introduced earlier, and maybe made more prominent, but there's a tradeoff.
https://github.com/Bhargav1912/test_1/pull/2/files
Following the files used reveals the pool and wallet used. The pool lets you look up the stats for this wallet. For this wallet, it says:
> Total Paid: 163000 TRTL - 42.16$
But I guess the culprit is rotating wallets. Judging by the hash rate, the pool estimates a weekly income of 700$. It could be a multiple of this if the culprit uses multiple wallets at once.
Anything with its own blockchain and also not popular is basically worthless
The mining rewards over a few months would still be just a fraction of a few million dollar marketcap network
But there are quite a few valuable ones you could get a decent take on, Tellor comes to mind.
GH hosted CI runs use Azure DS2 v2 instances. I'm not sure how GH is billed by Microsoft for compute, but the 3 year reserved pricing is $0.0405/hour.
So all up, that's around $2-4 of TRTL for $23.81 of compute.
Plus there's the real and opportunity cost of needing to assign engineers to try and prevent this from happening.
<3 Etherpad team