Live data from Hacker News

Unauthenticated remote code execution in OpenCode

cy.md

81–90 of 155 posts

Re: Unauthenticated remote code execution in OpenCode

#82
post #72

Many people seem to be running OpenCode and similar tools on their laptop with basically no privilege separation, sandboxing, fine-grained permissions settings in the tool itself. This tendency is reflected also by how many plugins are designed, where the default assumption is the tool is running unrestricted on the computer next to some kind of IDE as many authentication callbacks go to some port on localhost and th…

Hi. > Please run at least a dev-container or a VM for the tools. I would like to know how to do this. Could you share your favorite how-to?

I have a pretty non-standard setup but with very standard tools. I didn't follow any specific guide. I have ZFS as the filesystem, for each VM a ZVOL or dataset + raw image and libvirt/ KVM on top. This can be done using e.g. Debian GNU/ Linux in a somewhat straight forward way. You can probably do something like it in WSL2 on Windows although that doesn't really sandbox stuff much or with Docker/ Podman or with VirtualBox.

If you want a dedicated virtual host, Proxmox seems to be pretty easy to install even for relative newcomers and it has a GUI that's decent for new people and seasoned admins as well.

For the remote connection I just use SSH and tmux, so I can comfortably detach and reattach without killing the tool that's running inside the terminal on the remote machine.

I hope this helps even though I didn't provide a step-by step guide.

Re: Unauthenticated remote code execution in OpenCode

#84
post #59

A coworker raised an interesting point to me. The CORS fix removes exploitation by arbitrary websites (but obviously allows full access from the opencode domain), but let's take that piece out for a second... What's the difference here between this and, for example, the Neovim headless server or the VSCode remote SSH daemon? All three listen on 127.0.0.1 and would grant execution access to another process who could s…

If you have a localhost server that uses a client input to execute code without authentication, that’s a local code execution vulnerability at the very least. It becomes a RCE when you find a way to reach local server over the wire, such as via browser http request.

I don’t use VSCode you have mentioned so i don’t know how it is implemented but one can guess that it is implemented with some authentication in mind.

Re: Unauthenticated remote code execution in OpenCode

#85
post #14

Earlier quoted context omitted.

My original message was more positive but after more looking into context, I am a bit more pessimistic. Now I must admit though that I am little concerned by the fact that the vulnerability reporters tried multiple times to contact you but till no avail. This is not a good look at all and I hope you can fix it asap as you mention I respect dax from the days of SST framework but this is genuinely such a bad look espec…

the email they found was from a different repo and not monitored. this is ultimately our fault for not having a proper SECURITY.md on our main repository the issue that was reported was fixed as soon as we heard about it - going through the process of learning about the CVE process, etc now and setting everything up correctly. we get 100s of issues reported to us daily across various mediums and we're figuring out ho…

Also consider putting a security.txt[0] file on your main domain, like here: https://opencode.ai/.well-known/security.txt

I also just want to sympathize with the difficulty of spotting the real reports from the noise. For a time I helped manage a bug bounty program, and 95% of issues were long reports with plausible titles that ended up saying something like "if an attacker can access the user's device, they can access the user's device". Finding the genuine ones requires a lot of time and constant effort. Though you get a feel for it with experience.

[0] https://en.wikipedia.org/wiki/Security.txt

edit: I agree with the original report that the CORS fix, while a huge improvement, is not sufficient since it doesn't protect from things like malicious code running locally or on the network.

edit2: Looks like you've already rolled out a password! Kudos.

Re: Unauthenticated remote code execution in OpenCode

#86
post #72

Many people seem to be running OpenCode and similar tools on their laptop with basically no privilege separation, sandboxing, fine-grained permissions settings in the tool itself. This tendency is reflected also by how many plugins are designed, where the default assumption is the tool is running unrestricted on the computer next to some kind of IDE as many authentication callbacks go to some port on localhost and th…

Hi. > Please run at least a dev-container or a VM for the tools. I would like to know how to do this. Could you share your favorite how-to?

Hi. You are clearly an LLM user. Have you considered asking an LLM to explain how to do this? If not, why not?

Re: Unauthenticated remote code execution in OpenCode

#87

Lots of the same people that were behind: https://www.terminal.shop/ afaict, for that project they never went through PCI compliance. See original thread for more information: https://news.ycombinator.com/item?id=40228751 They seem to not have a lot of real world experience and/or throw caution to the wind and YOLO through security practices. I'd be weary using any of their products.

See also https://x.com/astuyve/status/2010772489605951912

Re: Unauthenticated remote code execution in OpenCode

#88

Seems that OpenCode is YC-backed as well [0] [1]. I would've thought YC would encourage better cyber security practice than OpenCode have demonstrated here. [0]: https://www.ycombinator.com/companies/sst [1]: https://anoma.ly/

Wow and they have an Auth provider product too!

Re: Unauthenticated remote code execution in OpenCode

#89
post #72

Many people seem to be running OpenCode and similar tools on their laptop with basically no privilege separation, sandboxing, fine-grained permissions settings in the tool itself. This tendency is reflected also by how many plugins are designed, where the default assumption is the tool is running unrestricted on the computer next to some kind of IDE as many authentication callbacks go to some port on localhost and th…

Hi. > Please run at least a dev-container or a VM for the tools. I would like to know how to do this. Could you share your favorite how-to?

>> Please run at least a dev-container or a VM for the tools.

> I would like to know how to do this. Could you share your favorite how-to?

See: https://www.docker.com/get-started/

EDIT:

Perhaps you are more interested in various sandboxing options. If so, the following may be of interest:

https://news.ycombinator.com/item?id=46595393

Re: Unauthenticated remote code execution in OpenCode

#90
post #59

A coworker raised an interesting point to me. The CORS fix removes exploitation by arbitrary websites (but obviously allows full access from the opencode domain), but let's take that piece out for a second... What's the difference here between this and, for example, the Neovim headless server or the VSCode remote SSH daemon? All three listen on 127.0.0.1 and would grant execution access to another process who could s…

Neovim’s server defaults to named pipes or domain sockets, which do not have this issue. The documentation states that the TCP option is insecure.

VS Code’s ssh daemon is authenticated.

Post reply on HN