Remix.run Logo
▲ tom1337 5 hours ago

> 1Password began investigating indications that an attacker gained access to an employee’s corporate GitHub account. The actor used the account to access source code and push malicious code to backend services, which downloaded administrative data pertaining to our customers.

Interesting that their is no code review in place and the attacker could just deploy something.

▲loginatnine 5 hours ago | parent | next [-]

They're of course light on the exact details but there are multiple ways this can be bypassed :

- If there's an external coding agent (copilot can be properly setup), if you can invoke `@codex` in a pull request to open a new pull request, you can then approve this agent-generated PR and merge it without human oversight

- If you don't have the "review the last reviewable commit" activated, someone can find an old unmerged but approved PR, add something in it and merge

- If you don't have the "dismiss previous approvals on push" setup with codeowners, if you have access to a github app with write access to the repo, you can find an old unmerged PR, push changes, use the app to approve your PR and merge (this can be protected by having a ruleset that require a review from at least 1 human with a team that does not contain the bots/app)

- If you're a GitHub repo admin, the ruleset might allow you to merge without review

- If you're a GitHub organization admin, you can disable rulesets, merge, and reenable them right away, making the attack very sneaky. Or just exclude your target repository.

- If users have the possibility to create blank repositories, then you can commit directly to main branch on the first commit, even though you have a ruleset that mandates pull requests. This works because the branch does not exist yet.

- If users have the possibility to create branches, a user can create a malicious protected branch, bypassing restrictions for the same reason as the previous point. Example : your ruleset protect `main` and `master` for backward compatibility. If user can create branches, they can push to a `master` branch on a repo where `main` is the main branch, bypassing restrictions.

There are multiple ways to get it wrong in GitHub and most people are not aware of these tradeoffs.

▲hnlmorg 5 hours ago | parent | prev | next [-]

More likely is they do have code review but haven’t enabled strict enough branch protection to prevent bypassing. Or this particular GitHub account has senior enough privileges to disable branch protection.

GitHub permissions are a joke. Github is more akin to a social network than an enterprise tool with regards to identity and RBAC. It’s a lot harder than it should be to give people autonomy without allowing abuse.

▲tom1337 5 hours ago | parent | next [-]

I'd disagree. GitHub branch protection rules can be setup so you simply cannot merge without a code review / passing tests etc. and branch protection has nothing to do with identity or RBAC. Maybe the user is able to bypass the protections but iirc you cannot globally disable them without entering "sudo mode" which requires a password. But also after that it's insane that the release can be started completely autonomous from one developers pc.

▲hnlmorg 3 hours ago | parent | next [-]

You say it’s got nothing to do with RBAC and then give an example of the limitations of GitHub’s RBAC.

The issue I was referring to was how anyone with admin access to the repo can disable branch protection. And if you can disable it, you can bypass it. But there are instances where you might want people to have admin access but not have the power to disable branch protection. But there isn’t enough granularity to do that

▲loginatnine 5 hours ago | parent | prev [-]

You are right that changing rulesets will trigger a 2FA check. But then again, the attacker might have the 2FA too if it's a OTP.

You are also right that it's possible to have a secure setup, however there are multiple ways to get it wrong (see my other reply in the parent thread).

▲a10c 4 hours ago | parent | prev [-]

FWIW in my company if you disable branch protection and push up to the now non-compliant branch it triggers a bunch of people's review (line manager, security, compliance etc)

▲hnlmorg an hour ago | parent [-]

In GitHub or Enterprise?

I’m curious, how did you set that up?

▲minaguib 5 hours ago | parent | prev | next [-]

^ This is what immediately caught my eye as well.

Mandating PRs has multiple benefits, but one of which is to prevent a single malicious actor from unanimously getting changes into production.

▲misker1 5 hours ago | parent | prev | next [-]

Maybe they got access to an administrator account, which can just bypass all code review settings (the button just turns red in Github, still clickable).

▲counters 5 hours ago | parent [-]

Even admin bypass can be disabled.

▲td521534f12 5 hours ago | parent | next [-]

Can you disable being able to disable the admin bypass? On my repos I have the bypass disabled but it's one command to re-enable it.

▲icedchai 5 hours ago | parent | prev [-]

Can't they just turn on admin bypass, then turn it off when they're "done"?

▲akmarinov 5 hours ago | parent | prev | next [-]

Or a disgruntled employee can just gruntle them really bad

▲fidotron 5 hours ago | parent | prev [-]

Raises the question of how many steps extra it would take for them to deploy malicious clients.

Would hope that has significant hoops to jump through.