Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cyber Sec+ Meet up Speaker doc

Cyber Sec+ Meet up Speaker doc

About API Security, explain abstract of OWASP API Top 10

Avatar for yki-yamamoto-csc

yki-yamamoto-csc

September 08, 2023
Tweet

Other Decks in Technology

Transcript

  1. ©Cyber Security Cloud Inc. All Rights Reserved 2 Index 1.

    Self Introduction 2. What and Why API Security 3. OWASP API Security Top 10 2019 a. Abstract b. demo 4. OWASP API Security Top 10 2023 5. How to Protect API 6. Summary
  2. ©Cyber Security Cloud Inc. All Rights Reserved 3 Self Introduction

    サイバーセキュリティクラウド 山本 悠貴 略歴 前職でエンジニアとしてスタートアップを 2社経験、倒産経験あり セキュリティ業界は当社が初経験 担当 攻撃遮断くん 開発エンジニア 兼 プロジェクトリーダー
  3. ©Cyber Security Cloud Inc. All Rights Reserved 4 What and

    Why API Security InjectionなどのDB のSyntaxの脆弱性をつく攻撃と異なり、そのAPI固有の不正な 使用による攻撃を防ぐためのものである。そのため、一般項による共通的な防ぎ 方が難しい。 API Securityとは何か なぜAPI Securityが重要か 近年、APIによる開発、システムが増大しており以下のような研究結果がある AkamaiのデータによるとAPIリクエストは、Webリクエストの全体の83%を占めてお り、 CloudflareのデータによるとAPIトラフィックはWebトラフィックに比べて300%の速度 で成長している。(2022年時点)
  4. ©Cyber Security Cloud Inc. All Rights Reserved 5 OWASP API

    Security Top 10 2019 No Title Description Company’s Case 1 Broken Object Level Authorization (BOLA) Tokenが一意のUserのものであるかを照合していないことによる認可不備。つまり、 User AのTokenでUser Bの認可を許可されてしまう。 Clubhouse Tinder 2 Broken User Authentication ユーザー認証機能に関するあらゆる脆弱性。 Microsoft 3 Excessive Data Exposure Responseに不要なデータを含むことにより不用意な情報流出につながる Google 4 Lack of Resource & Rate Liming Requestの回数制限(Rate Limiting)が設けられていないため、DDosやBrute-force attackが可能。Resourceの検証も行っていないため、サーバーのリソースを無駄に 使用する。 Venmo(Paypal) LinkedIn 5 Broken Function Level Authorization 管理者機能等に認証が実装されていないため、攻撃者が容易に管理機能へのアク セスが可能。特定のパスへの認証の不足。 Tesla 6 Mass Assignment リクエストの入力に本来想定していないパラメータを追加して不正な処理を実行させ る。 GitHub 7 Security Misconfiguration セキュリティに関わるあらゆる設定ミス。 JustDial 8 Injection SQL Injection, NoSQL Injection, OS Command Injection, XSS, …などのリクエス トに不正なコマンド,クエリを入力し実行する WordPress LEGO 9 Improper Assets Management 下位互換性のために、古いバージョンの API を実行したままにしておくことで下位 バージョンのAPIの脆弱性から攻撃される。等 WordPress 10 Insufficient Logging and Monitoring 不十分なログと監視。 OWASP API Security Top 10 とは  主要なAPI脅威をリストアップしたもの  2023も公開されているが重複や拡張が多いため2019に着目 https://owasp.org/API-Security/editions/2019/en/0x11-t10/
  5. ©Cyber Security Cloud Inc. All Rights Reserved 6 OWASP API

    Security Top 10 2019 抜粋 具体的なAPI固有のセキュリティの例 3. Excessive Data Exposure については、簡単に説明を行い 1. BOLA 6. Mass Assignment については、OWASP Juice Shopを例にBurpSuiteを用いて説明を行う 1. BOLA (Broken Object Level Authorization) 3. Excessive Data Exposure 6. Mass Assignment
  6. ©Cyber Security Cloud Inc. All Rights Reserved 7 Demo 3.Excessive

    Data Exposure ユーザー A API 他者の氏名や生年月日など の個人情報(PII)を含む情報 を取得できる
  7. ©Cyber Security Cloud Inc. All Rights Reserved 8 Demo 1.Broken

    Object Level Authorization (BOLA) /basket というURLに対してページを表 示しているが実際には...
  8. ©Cyber Security Cloud Inc. All Rights Reserved 9 Demo 1.Broken

    Object Level Authorization (BOLA) GET /rest/basket/1 というAPIに対しての Requestを送っており、 そのResponseを表示 していた Token = eyJ0eXA…
  9. ©Cyber Security Cloud Inc. All Rights Reserved 10 Demo 1.Broken

    Object Level Authorization (BOLA) GET /rest/basket/2 とRequest先を変えた だけで、 id=2の結果が取得でき た Token = eyJ0eXA…
  10. ©Cyber Security Cloud Inc. All Rights Reserved 11 Demo 6.Mass

    Assignment よくある ユーザー登録ページ
  11. ©Cyber Security Cloud Inc. All Rights Reserved 12 Demo 6.Mass

    Assignment POST /api/Users/ email, password, … , securityAnswer を Parameterとして Requestしている
  12. ©Cyber Security Cloud Inc. All Rights Reserved 13 Demo 6.Mass

    Assignment POST /api/Users/ email, password, … , securityAnswer に 加えて、 role: admin を Parameterとして Requestすると 実際にrole=admin のユーザーを 作成できた
  13. ©Cyber Security Cloud Inc. All Rights Reserved 14 OWASP API

    Security Top 10 2023 No Title Description Compare with 2019 1 Broken Object Level Authorization (BOLA) Tokenが一意のUserのものであるかを照合していないことによる認可不 備。つまり、User AのTokenでUser Bの認可を許可されてしまう。 変化なし 2 Broken Authentication 認証機能に関するあらゆる脆弱性。 やや拡張 3 Broken Object Property Level Authorization ResponseにSensitiveDataを含めている、Requestのパラメータを追加す ることを防いでいない。 拡張3. Excessive Data Exposure + 6. Mass Assignment 4 Unrestricted Resource Consumption 次のうち1つでも上限の設定がされていない場合。実行時間、割り当てメモ リ、ファイル記述、プロセス数、アップロードファイルサイズ、単一のAPIクラ イアントに対する命令数、単一のRequest-Response間でのrecord数 やや拡張 5 Broken Function Level Authorization 管理者機能等に認証が実装されていないため、攻撃者が容易に管理機能 へのアクセスが可能。特定のパスへの認証の不足。 変化なし 6 Server Side Request Forgery 最近のWebApplicationでは、次の構成によってユーザー入力から外部へ のアクセスが行われることが増加したためSSRFが一般的になった。 Webhooks, Custom SSO, URL previews.また、k8sやdocker技術の普及 によるwell-known path への攻撃。 新規追加 7 Security Misconfiguration セキュリティに関わるあらゆる設定ミス。 変化なし 8 Lack of Protection from Automated Threats スクレイピングなどのBOTによる自動アクセスに対する防御不足 新規追加 9 Improper Assets Management 下位互換性のために、古いバージョンの API を実行したままにしておくこと で下位バージョンのAPIの脆弱性から攻撃される。 変化なし 10 Unsafe Consumption of API 3rdParty製のAPIの入力に対するセキュリティの不備 新規追加 2019に着目した場合の変更点 https://owasp.org/API-Security/editions/2023/en/0x00-header/
  14. ©Cyber Security Cloud Inc. All Rights Reserved 15 How to

    protect API 解決策 ★ 適切なAPI設計・実装を行う ★ 画面上での制限をセキュリティ対策としない しかし、API Securityを開発者に委ねる, 自社でこれを実現するのは難しい 今後はよりユーザーの環境にフィットしたAPI防御サービスが重要になる WAFが今後不要になる訳ではない
  15. ©Cyber Security Cloud Inc. All Rights Reserved 16 Summary ▪

    昨今のWebSecurityではAPI Securityへの意識向上が重要 ▪ 主要なAPI脅威についてはOWASP API Security Top 10が参考となる ▪ 2019, 2023年版のものが存在するが、ベースは2019 ▪ APIを防御するためには ▪ 設計の段階から気を配る ▪ 開発者に任せるのは無理があるため、診断やAPI防御サービスを活 用する ▪ WAFの活用も有効