5

GitHub Copilot 產生出來程式的安全性問題

 2 years ago
source link: https://blog.gslin.org/archives/2021/07/03/10226/github-copilot-%e7%94%a2%e7%94%9f%e5%87%ba%e4%be%86%e7%a8%8b%e5%bc%8f%e7%9a%84%e5%ae%89%e5%85%a8%e6%80%a7%e5%95%8f%e9%a1%8c/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

GitHub Copilot 產生出來程式的安全性問題

看到「Encoding data for POST requests」這篇大家才回頭注意到 GitHub Copilot 首頁的範例本身就有安全漏洞:

async function isPositive(text: string): Promise<boolean> {
  const response = await fetch(`http://text-processing.com/api/sentiment/`, {
    method: "POST",
    body: `text=${text}`,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
  const json = await response.json();
  return json.label === "pos";
}

其中 text=${text} 是一個 injection 類的漏洞,首頁的範例應該是被挑過的,但仍然出現了這個嚴重的問題,從這邊可以看出 GitHubOpenAI 在這條線上的問題...

Related

GitHub 與 OpenAI 合作推出的 GitHub Copilot

在 Hacker News 首頁上的第一名看到 GitHub 與 OpenAI 合作推出了 GitHub Copilot,對應的討論可以在「GitHub Copilot: your AI pair programmer (copilot.github.com)」這邊看到。 GitHub Copilot 會猜測你接下來會想要寫的「完整片段」,像是這樣: 不過 Hacker News 上面的討論有參與 alpha 測試的人的評價,大概 1/10 機率會猜對,即使如此,他還是給了很多有用的資訊 (像是函式與變數的名稱): fzaninotto I've been using the alpha for the past 2 weeks, and I'm blown away. Copilot guesses the exact code I want…

June 30, 2021

In "Computer"

居然在安全性漏洞的 PoC 上面看到拿 Bad Apple!! 當作範例

人在日本的資安專家 Hector Martin 找到了 Apple M1 的安全漏洞,可以不用透過 macOS Big Sur 提供的界面,直接透過 M1 的漏洞跨使用者權限傳輸資料,這可以用在突破 sandbox 的限制。而也如同目前的流行,他取了一個好記的名字:「M1RACLES: M1ssing Register Access Controls Leak EL0 State」,對應的 CVE 是 CVE-2021-30747。 先講比較特別的點,PoC 的影片放在 YouTube 上,作者拿 Bad Apple!! 當作示範,這很明顯是個雙關的點: 這應該是當年的影繪版本,看了好懷念啊... 當年看到的時候有種「浪費才能」的感覺,但不得不說是個經典。 在 Hacker News 上有討論可以翻翻:「M1racles: An Apple M1 covert channel vulnerability (m1racles.com)」。 依照作者的說明,Apple A14 因為架構類似,也有類似的問題,不過作者沒有 iPhone,沒辦法實際測試: Are…

May 27, 2021

In "Computer"

GitHub 要求全面檢查 SSH Key

在 GitHub 被攻擊成功後 (參考 GitHub 官方所說的「Public Key Security Vulnerability and Mitigation」這篇),官方除了把漏洞修補完以外,接下來做了更積極的措施:暫停所有的 SSH key 存取權限,一律等到用戶 audit 確認過後才開放:「SSH Key Audit」。 這次 GitHub 除了修正問題、audit key 以外,另外還提出了新的機制讓用戶更容易發現異常存取行為,包括了: 新增 SSH public key 時要輸入密碼。 新增 SSH public key 成功後會寄信通知。 新增「Security History」頁面可以看到帳戶的安全狀況。 算是很積極補救的作法。 另外說明,要如何 audit key,也就是要如何取得你的 public key fingerprint: ssh-keygen -lf .ssh/id_rsa.pub (如果你是用 RSA) 或是 ssh-keygen -lf…

March 8, 2012

In "Computer"

a611ee8db44c8d03a20edf0bf5a71d80?s=49&d=identicon&r=gAuthor Gea-Suan LinPosted on July 3, 2021Categories Computer, Murmuring, Programming, SecurityTags code, copilot, example, github, injection, openai, sample, security

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

Post navigation


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK