Live data from Hacker News

How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

research.kudelskisecurity.com

191–200 of 244 posts

Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

#191
post #2

> While running the exploit, CodeRabbit would still review our pull request and post a comment on the GitHub PR saying that it detected a critical security risk, yet the application would happily execute our code because it wouldn’t understand that this was actually running on their production system. What a bizarre world we're living in, where computers can talk about how they're being hacked while it's happening. A…

Another proof that AI is not smart, it’s just really good at guessing.

Problem is, way to often it is not even good at guessing.

Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

#192
Developer tools really need to be more mindful of the fact that on developer machines, the current directory should not be trusted, and arbitrary code should not be executed from it. The git project has been learning this the hard way, and others should too.

For check-all-the-things (meta-linter), we disable the rubocop default config file using the "--config /dev/null" options.

Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

#193
https://www.coderabbit.ai/blog/our-response-to-the-january-2...

> No customer data was accessed

As far as I can tell this is a lie.

The real answer is that they have absolutely no clue if customer data was accessed, and no way to tell. I'm not even sure Github could tell, but it's not clear if the exploits way of generating private keys to access private repositories is any different to what CodeRabbit does in normal operation.

Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

#194

Yikes, this is a pretty bad vulnerability. It's good that they fixed it, but damning that it was ever a problem in the first place. Rule #1 of building any cloud platform analyzing user code is that you must run analyzers in isolated environments. Even beyond analysis tools frequently allowing direct code injection through plugins, linters/analyzers/compiler are complex software artifacts with large surface areas for…

Did I misread the article, or did they take the tool config from the PR not the repo?

The exploit is there either way.

Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

#195

Earlier quoted context omitted.

They first disabled rubocop to prevent further exploit, then rotated keys. If they awaited deploying the fix that would mean letting compromised keys remain valid for 9 more hours. According to their response all other tools were already sandboxed. However their response doesn't remediate putting secrets into environment variables in the first place - that is apparently acceptable to them and sets off a red flag for…

"According to their response all other tools were already sandboxed." Everything else was fine, just this one tool chosen by the security researcher out of a dozen of tools was not sandboxed.

Yeah, I thought the same. They were really unlucky, the only analyzer that let you include and run code was the one outside of the sandbox. What were the chances?

Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

#196

Yikes, this is a pretty bad vulnerability. It's good that they fixed it, but damning that it was ever a problem in the first place. Rule #1 of building any cloud platform analyzing user code is that you must run analyzers in isolated environments. Even beyond analysis tools frequently allowing direct code injection through plugins, linters/analyzers/compiler are complex software artifacts with large surface areas for…

Did I misread the article, or did they take the tool config from the PR not the repo?

Unfortunately that mostly has to be the case or else the developer experience configuring these would be too bad.

Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

#197
> Instead, it would be best to assume that the user may be able to run untrusted code through these tools. So, running them in an isolated environment, with only the minimum information required to run the tools themselves, and not passing them any environment variables would be much better. Even if arbitrary code execution would be possible, the impact would be much less severe.

> For defense in depth, one should add a mechanism that prevents sending private information to an attacker-controlled server. For example, only allow outgoing traffic to whitelisted hosts, if possible. If the tool doesn’t require internet access, then all network traffic may even be disabled in that isolated environment. This way it would make it harder for an attacker to exfiltrate secrets.

I yearn to live in a world where this is the default or at least REALLY EASY to do, where you just fall into the pit of success.

And yet, we live in a borderline insane world where one key getting leaked can pwn a million repos - if nothing else, there should be one key per interaction with account/repo. Not to mention that Rubocop (and probably other tools, eventually) have arbitrary code execution as a feature.

I don't think that CodeRabbit messed up, as much as everything around them is already messed up.

Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

#198

Earlier quoted context omitted.

Did I misread the article, or did they take the tool config from the PR not the repo?

The exploit is there either way.

The exploit depends on changing the config to execute a .rb file. And the config was supplied by a PR.

Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

#199
post #2

> While running the exploit, CodeRabbit would still review our pull request and post a comment on the GitHub PR saying that it detected a critical security risk, yet the application would happily execute our code because it wouldn’t understand that this was actually running on their production system. What a bizarre world we're living in, where computers can talk about how they're being hacked while it's happening. A…

Move fast and break things
Post reply on HN