Skip to content

The local CLI api is open to all apps #13571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
RikudouSage opened this issue Feb 25, 2025 · 7 comments · May be fixed by #14262
Open
1 task done

The local CLI api is open to all apps #13571

RikudouSage opened this issue Feb 25, 2025 · 7 comments · May be fixed by #14262
Labels
bug cli CLI Application

Comments

@RikudouSage
Copy link

Steps To Reproduce

As already stated in #3932, once the API is served, anyone on the local machine can use it. Adding an authorization header with the session id would be the best solution. Specifying a custom password for the server using basic auth would be another good option that would allow the application that started the server to control the access.

Currently this is very insecure which is shocking in a product like Bitwarden. You can make the flag optional and then your "tightly controlled environment" (which presumably doesn't have any viruses) can run without any password, while the rest of us can be sure that we're not leaking any passwords to anything snooping on the computer.

Expected Result

I cannot do a plain GET request to get all my passwords unencrypted.

Actual Result

Any app can do a GET request to get a list of all passwords unencrypted.

Screenshots or Videos

No response

Additional Context

No response

Operating System

Linux

Operating System Version

No response

Shell

Bash

Build Version

2025.1.3

Issue Tracking Info

  • I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
@RikudouSage RikudouSage added bug cli CLI Application labels Feb 25, 2025
@bitwarden-bot
Copy link

Thank you for reporting this issue! We've added this to our internal tracking system.
ID: PM-18645

@rbur004
Copy link

rbur004 commented Feb 28, 2025

Apple's approach is a good one.

They require every app accessing a password from the keychain, to have the user authorize either 'allow once', or 'allow always' access for the app requesting access. They must be keeping a mapping of which apps are authorized to access which passwords.

@Game4Move78
Copy link

Game4Move78 commented Apr 13, 2025

One workaround is using Caddy in a Docker container to access the vault through HTTPS with basic authentication. As long as Docker is restricted to privileged users, you can require a password for all requests when the vault is unlocked..

I've implemented it in this repo.

@RikudouSage
Copy link
Author

My use case is running the BW server on the target device, not on server, so the Caddy thing doesn't help. For now I do patch the source code to add an API key support. I've implemented it as a source generator which is less likely to break than a simple patch: https://github.com/RikudouSage/harbour-bitsailor/blob/master/patch/plugin.js

@Game4Move78
Copy link

Running Docker container with -p 127.0.0.1:8080:8080 exposes it to localhost only, and Caddy's internal TLS encrypts the connection. It should work for your use case if I understand. Caddy supports header tokens or session certificates with mTLS, so its quite flexible.

@RikudouSage
Copy link
Author

It doesn't, it's running as part of another app on an end-user device, I cannot make assumptions, nor force the following to happen:

  • caddy being installed
  • docker being installed

I don't think docker is even available for the device I'm targeting.

@Game4Move78
Copy link

Understandable! One idea would be to create your own isolated network namespace for the express server and expose it via a Unix domain socket. You can then add your preferred authentication method between the socket and the client. Tools like Caddy and Docker handle this automatically, but it may be possible to implement it yourself. Since you're allowed to modify the Bitwarden source code, you could implement the caching yourself — similar to how rbw handles it. I think your patch still leaves it open to apps that monitors data in transit.

Do you think this issue be resolved if bw serve supported Unix domain sockets with http://unix://? I think it would only require a small change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli CLI Application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants