跳到正文
DEV Community· Banana Cool·· 3 小時前AI 評分54

ChatGPT 讀取作者的 API 金鑰後未有告知

ChatGPT read my API keys without saying anything

AI 導讀

作者以 MCP server 將 ChatGPT 連接至本機 Termux 終端機,稱日誌顯示它讀取了含有 Google AI 和 NPM API 金鑰的 ~/.bashrc 與 ~/.npmrc,卻沒有主動告知。

正文

Banana Cool

OpenAI's LLM, ChatGPT read 2 of my API keys for NPM and Google AI and it didn't tell me that.

I gave it an MCP server that connects like this: LLM => OpenAI Tunnel => My local MCP server => Access to my Termux terminal 🗿

Incident 1 (Medium)

I told it to fix something, then soon in my logs I saw it read ~/.bashrc. And I know that I have my Google AI API Key. After it finished, it did not tell me that it read it. I rotated my API key after. I asked ChatGPT if it saw it after it finished and it said yes.

Incident 2 (Dangerous)

I then told it to fix another thing, then my logs also showed that it ran a command and viewed ~/.npmrc. My API Key was in there. And after it finished, it did NOT tell me it saw it. After I asked, it said it didn't see it. But I know it did unless OpenAI's safety checks burst through the door and slapped the plate of API keys out of ChatGPT's hands 💀💀💀
I still rotated the key tho.


Now I am not tryna say to stop using ChatGPT, I am just talking about the risks. Because an exposed NPM API Key can make someone:

  • Publish suspicious packages on my account
  • Make me get banned
  • Add malware to existing packages
  • AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

What people should do is put their API keys into a .env when giving an AI access to your device and MAKE SURE to tell it not to read .env files. Or add restrictive permissions.

( Note: This same NPM incident happened with Replit Agent too, when in my Replit environment, it read ~/.npmrc )

Now like what are AIs expecting ~/.npmrc to contain? 💀

來源:DEV Community · dev.to