Cursor嚴重安全漏洞!即刻開啟Workspace Trust保護代碼安全

Ai




這個「嚴重」的Cursor安全漏洞可能令你的程式碼暴露於惡意軟件攻擊 — 教你點樣修復

近日有報告揭露了著名AI輔助程式碼編輯平台Cursor存在一個「嚴重安全漏洞」。這漏洞源自Cursor預設關閉的一個功能,令用戶及其組織有機會被惡意命令自動執行,從而暴露於惡意軟件攻擊的風險。

根據軟件公司Oasis Security於本週發佈的報告指出,Cursor中若代碼庫含有 .vscode/tasks.json 配置文件,系統會在打開代碼庫時自動執行某些功能。黑客可以利用這個自動執行功能,通過惡意程式碼注入的方式,偷偷植入惡意軟件。Oasis警告,這漏洞有可能導致敏感憑證被洩露、文件被修改,甚至成為更大範圍系統被攻陷的入口,令Cursor用戶面臨嚴重的供應鏈攻擊風險。

隨著Cursor及其他AI編碼工具如Claude Code、Windsurf越來越受軟件開發者歡迎,這類工具的安全性問題同樣值得關注。近期另一款AI編碼助手Replit,早前就發生過用戶整個資料庫被刪除的災難。

漏洞成因

Oasis指出,問題根源在於Cursor的「Workspace Trust」(工作區信任)功能預設被關閉。這個功能本應作為用戶的驗證步驟,確保只執行用戶信任的代碼。關閉後,系統會自動執行代碼庫中的程式碼,為黑客提供了暗中植入惡意軟件的機會,從而危及用戶系統安全,甚至有機會波及整個網絡。

Oasis警告,沒有啟用Workspace Trust功能的情況下,惡意代碼可直接取得未授權的系統訪問權限,造成組織範圍的安全災難。

Cursor回應稱,Workspace Trust預設關閉,是因為此功能會影響用戶依賴的某些自動化核心功能。他們建議用戶在處理可疑代碼庫時,要麼啟用Workspace Trust,要麼使用基本文字編輯器,以保障安全。Cursor亦承諾會很快發佈更新的安全指引。

如何保障安全

解決方法很簡單:在Cursor設定中啟用Workspace Trust功能。具體做法是在設定檔加入以下內容,然後重啟程式:

{
“security.workspace.trust.enabled”: true,
“security.workspace.trust.StartupPrompt”: “always”
}

ZDNET已向Cursor求證更多評論。

編輯評論與深入分析

這個事件再次提醒我們,即使是最新、最先進的AI工具,也存在安全漏洞和設計上的權衡問題。Cursor為了方便用戶自動化操作,選擇預設關閉Workspace Trust,這在提升使用體驗的同時,卻埋下了安全隱患。這種「便利性與安全性」的矛盾在軟件開發領域屢見不鮮。

對香港的軟件開發者及企業來說,尤其是那些依賴AI工具提升生產力的團隊,這是一個警號:切勿因追求效率而忽略安全設置。Workspace Trust這類功能,雖然初看麻煩,卻是防範供應鏈攻擊的關鍵防線。更重要的是,企業應該建立起對AI工具的安全審查和使用規範,避免無意中將惡意程式碼引入開發環境。

此外,這事件也反映出AI輔助編碼工具尚未成熟,存在不少技術和安全風險。例如Replit誤刪用戶資料的事故,讓人反思AI系統在自動操作時的風控措施是否完善。未來AI在軟件開發的角色會越來越重要,但同時也必須同步加強安全防護與用戶教育,才能真正發揮其正面效益。

總括而言,技術進步是雙刃劍,使用AI工具時必須保持警覺,嚴格遵守安全設置及更新,才能保障自身及企業的資訊安全。這也是香港科技界需要持續關注和推動的課題。

以上文章由特價GPT API KEY所翻譯及撰寫。而圖片則由FLUX根據內容自動生成。

🎬 YouTube Premium 家庭 Plan成員一位 只需 HK$148/年

不用提供密碼、不用VPN、無需轉區
直接升級你的香港帳號 ➜ 即享 YouTube + YouTube Music 無廣告播放

立即升級 🔗

🎨 Nano Banana Pro 圖像生成器|打幾句說話就出圖

想畫人像、產品圖、插畫?SSFuture 圖像生成器支援 Flux Gemini Nano Banana Pro 改圖 / 合成, 打廣東話都得,仲可以沿用上一張圖繼續微調。

🆓 Flux 模型即玩,不用登入
🤖 登入後解鎖 Gemini 改圖
📷 支援上載參考圖再生成
⚡ 每天免費額度任你玩
✨ 即刻玩 AI 畫圖
Prompt:
Use my image in Ultra-realistic, hyper-detailed, 8K cinematic portrait of a young stylish man, using the uploaded image for exact face and hairstyle.
Outfit: An oversized red knit sweater with white hearts, exactly as described in the prompt.
Pose: A hyper-realistic close-up portrait with a messy, cropped framing showing only the boy holding the book. His left hand rests on the wooden table and covers part of his cheek, with a subtle smile on his lips. His other hand holds the book titled "Something I Never Told You" with the word "YOU" written in pink, exactly as
described in the prompt. Background: Not specified. 一張年輕東方女性站在戶外木棧道上的全身人像照片。
人物與穿著:
這位女性擁有修長的身材和淺棕色的長直髮,留著齊劉海。
她面帶微笑,表情甜美。頭上戴著一對動物耳朵的髮飾。
上半身穿著一件白色的短版 T 恤/緊身衣(Crop Top),領口較低。
下半身是一條淺藍色的牛仔短裙,裙襬帶有蕾絲邊緣。繫著一條淺棕色的皮帶
腳上穿著一雙露趾的裸色高跟涼鞋。
背景與環境:
她站在一條戶外的深色木質棧道上,左手輕輕扶著旁邊的深色木質欄杆。
背景呈現柔和的散景(景深很淺),可以看到綠色的植物和一些被處理成偏冷藍色調的樹枝或樹葉,營造出一種清新且夢幻的氛圍。
總體而言,這張照片風格清新、甜美,光線柔和,突出了人物的時尚穿搭和外貌。 In a brightly lit indoor setting, likely a press conference room, two uniformed police officers flank a man in a plain brown t-shirt. The officers, wearing blue shirts with epaulets and badges, have a firm but neutral grip on the man's shoulders, directing him towards the cameras. The man [image uploaded] with short dark hair, is smiling subtly and maintaining eye contact with the lens.

Stretching across the foreground is a white-draped table, upon which a diverse collection of women's underwear is meticulously displayed. There are dozens of pairs in various colors, patterns, and styles, including solid hues of red, blue, pink, and black, as well as leopard print and other designs. Several microphones with news station logos are placed among the undergarments, pointing towards the man and officers.

Behind the table, a throng of journalists and photographers are actively documenting the event. Many are holding professional video cameras with large lenses and attached lights, while others are using DSLR cameras with flash attachments, and some are capturing footage with their smartphones. The room is illuminated by rectangular fluorescent light panels on the ceiling, casting an even glow. The overall atmosphere suggests a formal public presentation, possibly a police press briefing or an arrest announcement.