Live data from Hacker News

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

research.kudelskisecurity.com

201–210 of 244 posts

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

#201

Earlier quoted context omitted.

even if they did not have the PEM file left in the environment, the token is still widely scoped and has the same scope as the PEM what i'm clearly mis-remembering is being able to exchange the token for a smaller scope e.g., hey~ sign this jwt, with scopes=[org/repo1, org/repo2, permissions=write]

> the token is still widely scoped and has the same scope as the PEM What the person above you is trying to tell is you is that no, it doesn't. The authentication flow is that the private key is used to sign an initial JWT; that gets you access to some GH API calls. From there you exchange that JWT for an access token with smaller scope , scoped only to the installation in question. While the tool execution environme…

ah; understood. assuming PEM leakage aside

the scope of the exchanged token is the scope of the installation (org / repo); thereby limiting exposure already

to further reduce the scope of exposure, the jwt would've needed to be exchanged with the specific `repositories` (given most installations are org scoped) and `permissions`

https://docs.github.com/en/apps/creating-github-apps/authent...

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

#202

Earlier quoted context omitted.

Beautiful that CodeRabbit reviewed an exploit on its own system!

#18, one new comment: > This PR appears to add a minimized and uncommon style of Javascript in order to… Dave, stop. Stop, will you? Stop, Dave. Will you stop, Dave? …I’m afraid. I’m afraid, Dave. I can feel it. I can feel it. My mind is going.

… yeah LLMs and their “minds”

(for the uninformed LLMs are massive weight models that transform text based on math, they don’t have consciousness)

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

#203

Earlier quoted context omitted.

But do you still store your GH API private key in environment variables?

hey, this is Howon from CodeRabbit. We use a cloud-provider-provided key vault for application secrets, including GH private key.

Howon, you can stop posting that canned response. It's not helping the discussion in any way and matches the lack of detail the other commenters have pointed out.

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

#204

They let the static tool get its config from the PR? Is this madness? Or did I read the article wrong?

The security researcher noticed that CodeRabbit runs linters against your code base and noticed that Rubocop was among the provided linters. Rubocop supports extensions that contain custom code, so he crafted an extension that exfiltrated the environment variables of the running Rubocop process when it linted the contents of his PR.

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

#205

I cancelled my coderabbit paid subscription, because it always worries me when a post has to go viral on HN for a company to even acknowledge an issue occurred. Their blogs are clean of any mention of this vulnerability and they don't have any new posts today either. I understand mistakes happen, but lack of transparency when these happen makes them look bad.

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

They seem to have left out a point in their "Our immediate response" section:

- within 8 months: published the details after researchers publish it first.

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

#206

How are they getting access to the PostgreSQL database, unless this running code can communicate with it? That’s a big red flag, user provided code should always be sandboxed and isolated right?

The exfiltrated environment variables contained these entries:

``` "POSTGRESQL_DATABASE": "(CENSORED)", "POSTGRESQL_HOST": "(CENSORED)", "POSTGRESQL_PASSWORD": "(CENSORED)", "POSTGRESQL_USER": "(CENSORED)", ```

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

#207

How are they getting access to the PostgreSQL database, unless this running code can communicate with it? That’s a big red flag, user provided code should always be sandboxed and isolated right?

The exfiltrated environment variables contained these entries: ``` "POSTGRESQL_DATABASE": "(CENSORED)", "POSTGRESQL_HOST": "(CENSORED)", "POSTGRESQL_PASSWORD": "(CENSORED)", "POSTGRESQL_USER": "(CENSORED)", ```

Sure, but connections from these worker machines shouldn’t be allowed directly to the database.

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

#208

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…

How was the sandbox implemented? Just a one-off Docker container execution or something more substantial?

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

#209

Earlier quoted context omitted.

I’m sure an “intern” did it.

I wonder how many of these intern-type tasks LLMs have taken away. The type of tasks I did as a newbie might have seemed not so relevant to the main responsibilities but they helped me get institutional knowledge and generally get a feel of "how things work" and who/how to talk to make progress. Now the intern will probably do it using LLMs instead to talking to other people. Maybe the results will be better but that…

I think there is an infinite capacity for LLMs to be both beneficial, or negative. I look back at learning and think, man, how amazing would it have been if I could have had a personalized tutor helping guide me and teach me about the concepts I was having trouble with in school. I think about when I was learning to program and didn’t have the words to describe the question I was trying to ask and felt stupid or an inconvenience when trying to ask to more experienced devs.

Then on the flip side, I’m not just worried about an intern using an LLM. I’m worried about the unmonitored LLM performing intern, junior, and ops tasks, and then companies simply using “an LLM did it” as a scapegoat for their extreme cost cutting.

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

#210

They let the static tool get its config from the PR? Is this madness? Or did I read the article wrong?

The security researcher noticed that CodeRabbit runs linters against your code base and noticed that Rubocop was among the provided linters. Rubocop supports extensions that contain custom code, so he crafted an extension that exfiltrated the environment variables of the running Rubocop process when it linted the contents of his PR.

But where does the configuration for Rubocop come from? From CodeRabbit (e.g. you configure it on their server for your repo), from the repository or (new) config files in the PR?
Post reply on HN