heroku

【heroku OAuth 流出】herokuとgithubが連携できない(2022年4月)

2022/4/25に急にgithubとherokuの連携ができなくなりました。その原因を調査しました。

エラー内容

エラーとしては、”Item could not be retrieved:Internal Server Error”。

”アイテムが取得できません。内部サーバーエラー”

Internal server Error

エラーによってできない具体的な内容は以下の通り。

  • Githubをherokuとの連携
  • 連携を利用したDeploy

原因

調査した結果、Herokuに報告が上がっていました。

https://status.heroku.com/incidents/2413

herokuからのGithubのプライベートレポジトリの流出”があったそうです。その流出への対応として、全てのherokuとgithubの連携を削除したようです。

以下、関係箇所の全文です。

Issue

At Salesforce, trust is our number one value. We’re actively investigating a report received on April 13, 2022, from GitHub that a subset of Heroku’s GitHub private repositories, including some source code, were downloaded by a threat actor on April 9, 2022. We proactively notified our Heroku customers regarding this issue and will continue to provide updates to assist them as the investigation continues. If Salesforce or GitHub becomes aware of unauthorized access to customer GitHub repositories connected to Heroku, we will notify affected customers by email without undue delay


APR 15, 2022 22:32 UTC

Update

Heroku Security Update: GitHub integration mitigation steps


To mitigate impact from potentially compromised OAuth tokens, we will revoke over the next several hours all existing tokens from the Heroku GitHub integration. We are also preventing new OAuth tokens from being created until further notice. Your GitHub repositories will not be affected in any way by this action.


Currently running Heroku applications will not be affected, but this will prevent you from deploying your apps from GitHub through the dashboard or via automation. Some other actions in the dashboard will no longer work due to this mitigation, and you will be unable to reconnect to GitHub even though you may see warning banners about reconnecting. As a temporary workaround, you can use one of the other code deployment methods available in the following documentation:

APR 16, 2022 04:04 UTC

一部でニュースにもなっていました。

https://project.nikkeibp.co.jp/idg/atcl/19/00002/00333/

Herokuのこれまでの対応(一部抜粋)

  • Githubとのダッシュボードでの経由の連携解除
  • herokuのログインパスワードのリセット

対策(2022/4/25現在)

個人利用を想定しています。法人の場合など、組織的に使用していた場合もう少し複雑な対応が必要です。

  • 念のため、Githubとの連携を解除
  • パスワードのリセットと変更
  • Heroku CLIを使用してDeploy

今後もアップデートの情報を更新していきます。

更新情報(2022/4/16,17)

GitHubとHerokuの統合を全て解除されました。

以下、関係箇所の全文です。

heroku流出
heroku流出

更新情報(2022/4/19)

よくある質問がまとめらています。一部抜粋します。

不正アクセス等の証拠となるGithubのログ調査について、追加のガイダンスはどのように取得できますか?

以下が必要なアクションのようです。

プライベートリポジトリに秘密や認証情報が保存されていないか、すべて確認しましょう。GitHub secret scanning や trufflehog など、この作業を支援するツールがいくつかあります。

個人アカウントや組織へのアクセスを許可した OAuth アプリケーションを見直し、不要になったものを削除します。
GitHub のガイドラインに従って、GitHub の組織のセキュリティ体制を強化する。

アカウントのアクティビティ、個人用アクセストークン、OAuth アプリケーション、SSH キーを見直し、攻撃者から来たと思われるアクティビティや変更がないか確認します。

  • Review all your private repositories for secrets or credentials stored in them. There are several tools that can help with this task such as GitHub secret scanning and trufflehog.
  • Review the OAuth applications that you’ve authorized for your personal account or that are authorized to access your organization and remove anything that’s no longer needed.
  • Follow GitHub’s guidelines for hardening the security posture of your GitHub organization.
  • Review your account activity, personal access tokens, OAuth apps, and SSH keys for any activity or changes that may have come from the attacker.

Herokuダッシュボード経由でGithubとの連携ができない間、コードをデプロイする方法ありますか?

Integrating with Version Control Providers Besides GitHub

Deploying with Git

HerokuとGithubの連携されなくなったことで何ができなくなりますか?

  • Enabling review apps
  • Creating (automatic and manual) review apps
  • Deploying (automatic and manual) review apps
  • Deploying an app from GitHub (either manual or automatic)
  • Heroku CI cannot create new runs (automatically or manually) or see GitHub branch list
  • Heroku Button: unable to create button apps from private repositories
  • ChatOps: unable to deploy or get deploy notifications
  • Any app with a GitHub integration may be affected by this issue. To address specific integration issues, please open a case with Heroku Support

HerokuとGithubの連携はいつどのように通知されますか?

下記のURLが随時、更新される。

https://status.heroku.com/

更新情報(2022/4/26)一部抜粋

GitHubとの再連携は、安全のために避けてください。

Herokuアプリをデプロイする最もシンプルな方法は、git push heroku mainを直接使用することです。

更新情報(2022/5/4)一部抜粋

アカウントのパスワードが全てリセットされるそうです。

登録してあるメールからパスワードのリセットが必要です。

更新情報(2022/5/5)

これまでの経緯がまとめられた内容が投稿されました。

・2022年4月15日にアナウンスしたインシデントに継続して対応している

・2022年4月7日、a threat actor(データベースの侵入者)は、herokuデータベースへアクセスし、GithubのOAuth tokensをダウンロードした

・Githubによれば、2022年4月8日にダウンロードしたOAuth tokensで顧客のリポジトリに関するメタデータを列挙を始めた。

・2022年4月9日、侵入者はGithubのプライベートリポジトリをダウンロードした。その中にはHerokuのソースコードも含まれている

・2022年4月12日、Githubが上記のデータ流出を確認。

・2022年4月13日、GithubがSalesforceに上記の旨を通知

・2022年4月16日、OAuthトークンを失効させ、GitHubからアプリへデプロイを停止 (2022/4/16,17 更新情報

・追加調査によって、同じ漏洩したトークンでデータベースへのアクセスがあり、ユーザーアカウントのハッシュ化およびソルト化されたパスワードを流出させたことが判明

・2022年5月4日、すべての Heroku ユーザーのパスワードをリセット。(2022/5/4 更新情報

以下、原文です。

heroku流出

関連記事

heroku
最新情報をチェックしよう!