SlideShare a Scribd company logo
1 of 17
マルチパート MIME を返す Web アプリケー
ションにおける脆弱性

マルチパート MIME 境界注入攻撃とその対策
Vulnerability on web application returns multipart MIME content
 Attack and defense method for Multipart MIME delimiter Injection
multipart な MIME コンテンツの仕様
(RFC2046)

 Content-type: multipart/*; boundary=”boundary text”


  と書くと
   [CRLF]--boundary text(スペース)* [CRLF]
  がボディの各パートの区切りとなる
  
 各パートはこの区切を含んではいけない(MUST NOT)。
含んでいるとどうなるのか
   Content-type: multipart/x-mixed-replace; boundary=AAA

   --AAA
   Content-type: text/plain; charset=UTF-8

   プレーンテキスト部
   その1
   --AAA
   Content-type: text/plain; charset=UTF-8

   プレーンテキスト部
   その2
   --AAA--
ここで 「その2」を

「--AAA[CRLF]
 Content-type: text/html; charset=UTF-8 [CRLF][CRLF]
 <html><script>alert(1)</script></html>[CRLF]」


に変えたら?
こうなります。
    Content-type: multipart/x-mixed-replace; boundary=AAA

    --AAA
    Content-type: text/plain; charset=UTF-8

    プレーンテキスト部
    その1
    --AAA
    Content-type: text/plain; charset=UTF-8

    プレーンテキスト部
    --AAA
    Content-type: text/html; charset=UTF-8

    <html><script>alert(1)</script></html>
    --AAA--
2 パート目が分割されて JavaScript 入りの HTML が注入され

てしまいました。
    Content-type: text/plain; charset=UTF-8

    プレーンテキスト部



    Content-type: text/html; charset=UTF-8

    <html><script>alert(1)</script></html>
これがマルチパート MIME デリミタの注入によるコンテンツ
の改竄です。


これは、Web サーバのレスポンスで発生すれば HTTP レスポン

ス分割、E メールに使用すればメールの改竄となります。
問題への対策

 (1)エスケープやサニタイズは本質的な対策ではない


  ・コンテンツの各パートの種類によってはエスケープする
   方法がない(text/plain など)。
  ・ Content-Transfer-Encoding: base64 や US-ASCII の上
   位互換ではないエンコーディングを使えば HTML 等の
   エスケープを迂回できる
(2)本質的な対策
 
 絶対に delimiter をコンテンツ本体部に注入できないよう
 にする。
具体的には以下のいずれかを行う

(1)
      事前に全てのパートに delimiter が含まれないことを確
      認する(事前に全パートの内容が確定している場合に
      有効な方法。静的ページならこれで十分)

(2)
      各 パー トを Content-Transfer-Encoding: base64 とし
      て base64 で パ ー ト 本 体 を エ ン コ ー ド に す る
      (delimiter 先頭の”--”の注入が不可能になる)。
(3)
      boundary をランダムにすることで攻撃者が実用的なコ

      ストで故意に衝突させることが出来ない様にする

(4)
      Animation GIF や動画などの代替技術を使う
実用的な攻撃が成功する条件の検証

1.
     delimiter の注入が成功する条件

        --boundary text
     とその前後の[CRLF]の間が空白文字だけであること


     ※RFC と違って Gecko は --boundary text の前に

     スペースがあっても構わない
   
2.
     注入された body-part を攻撃者にとって有効なものにする
     ための条件


     以下のいずれかが出来る必要がある
     ・
         body part の Content-* ヘッダ注入できる

     ・ multi part の終端が注入できる
     ・ 攻撃者の注入した文字列の後ろに意味のある文字列が
         全く存在しない
安全なライブラリの使い方(Web ブラウザへ返す応答の場合)

(1)
      CGI.pm の multipart_init()

 ・毎回同じ boundary 指定で呼んでいるとバージョンに関係
      なく危険。
 ・を予測不能な boundary を指定して呼べば安全
 ・boundary 指定無しで使う場合は、 Ver.3.50 以降では自動
      で ラ ン ダ ム な boundary が 採 用 さ れ る の で 安 全 だ が 、
      Ver.3.49 以前は毎回同じ boundary なので危険
(2)
      CGI.pm の CGI:Push

 ・比較的古くから安全(自動でランダムな boundary を生成)
 ・念のためソースを確認して boundary がランダムであるこ
      とを確認する

(3)
      CGI:Simple の multipart_init()

 ・boundary 指定がある場合の条件は CGI.pm と同じ
 ・github の 2010 年 11 月 13 日の更新を含むバージョン以降
      は boundary 指定無しでも安全
安全なライブラリの使い方(E メールの動的な生成)


すいません、未調査です。
ソースを確認して適切な実装のライブラリを使って下さい。
まとめ
・ HTTP レスポンス分割は HTTP ヘッダインジェクション
 だけじゃない。


・ MIME の boundary は中身が予想できないならランダム
 にするのが正しいあり方。実際、メールクライアントはほ
 とんどがそのように実装されている。
・安全なサンプルコードが少ないので注意。

More Related Content

Recently uploaded

CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?akihisamiyanaga1
 
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfクラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfFumieNakayama
 
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfAWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfFumieNakayama
 
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineerYuki Kikuchi
 
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)UEHARA, Tetsutaro
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)Hiroshi Tomioka
 
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...博三 太田
 
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案sugiuralab
 

Recently uploaded (8)

CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
 
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfクラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
 
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfAWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
 
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
 
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
 
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
 
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

MIMEデリミタ注入攻撃

  • 1. マルチパート MIME を返す Web アプリケー ションにおける脆弱性 マルチパート MIME 境界注入攻撃とその対策 Vulnerability on web application returns multipart MIME content Attack and defense method for Multipart MIME delimiter Injection
  • 2. multipart な MIME コンテンツの仕様 (RFC2046)  Content-type: multipart/*; boundary=”boundary text” と書くと [CRLF]--boundary text(スペース)* [CRLF]  がボディの各パートの区切りとなる   各パートはこの区切を含んではいけない(MUST NOT)。
  • 3. 含んでいるとどうなるのか Content-type: multipart/x-mixed-replace; boundary=AAA --AAA Content-type: text/plain; charset=UTF-8 プレーンテキスト部 その1 --AAA Content-type: text/plain; charset=UTF-8 プレーンテキスト部 その2 --AAA--
  • 4. ここで 「その2」を 「--AAA[CRLF] Content-type: text/html; charset=UTF-8 [CRLF][CRLF] <html><script>alert(1)</script></html>[CRLF]」 に変えたら?
  • 5. こうなります。 Content-type: multipart/x-mixed-replace; boundary=AAA --AAA Content-type: text/plain; charset=UTF-8 プレーンテキスト部 その1 --AAA Content-type: text/plain; charset=UTF-8 プレーンテキスト部 --AAA Content-type: text/html; charset=UTF-8 <html><script>alert(1)</script></html> --AAA--
  • 6. 2 パート目が分割されて JavaScript 入りの HTML が注入され てしまいました。 Content-type: text/plain; charset=UTF-8 プレーンテキスト部 Content-type: text/html; charset=UTF-8 <html><script>alert(1)</script></html>
  • 7. これがマルチパート MIME デリミタの注入によるコンテンツ の改竄です。 これは、Web サーバのレスポンスで発生すれば HTTP レスポン ス分割、E メールに使用すればメールの改竄となります。
  • 8. 問題への対策 (1)エスケープやサニタイズは本質的な対策ではない   ・コンテンツの各パートの種類によってはエスケープする 方法がない(text/plain など)。 ・ Content-Transfer-Encoding: base64 や US-ASCII の上 位互換ではないエンコーディングを使えば HTML 等の エスケープを迂回できる
  • 9. (2)本質的な対策   絶対に delimiter をコンテンツ本体部に注入できないよう にする。
  • 10. 具体的には以下のいずれかを行う (1) 事前に全てのパートに delimiter が含まれないことを確 認する(事前に全パートの内容が確定している場合に 有効な方法。静的ページならこれで十分) (2) 各 パー トを Content-Transfer-Encoding: base64 とし て base64 で パ ー ト 本 体 を エ ン コ ー ド に す る (delimiter 先頭の”--”の注入が不可能になる)。
  • 11. (3) boundary をランダムにすることで攻撃者が実用的なコ ストで故意に衝突させることが出来ない様にする (4) Animation GIF や動画などの代替技術を使う
  • 12. 実用的な攻撃が成功する条件の検証 1. delimiter の注入が成功する条件 --boundary text とその前後の[CRLF]の間が空白文字だけであること ※RFC と違って Gecko は --boundary text の前に スペースがあっても構わない    
  • 13. 2. 注入された body-part を攻撃者にとって有効なものにする ための条件 以下のいずれかが出来る必要がある ・ body part の Content-* ヘッダ注入できる ・ multi part の終端が注入できる ・ 攻撃者の注入した文字列の後ろに意味のある文字列が 全く存在しない
  • 14. 安全なライブラリの使い方(Web ブラウザへ返す応答の場合) (1) CGI.pm の multipart_init() ・毎回同じ boundary 指定で呼んでいるとバージョンに関係 なく危険。 ・を予測不能な boundary を指定して呼べば安全 ・boundary 指定無しで使う場合は、 Ver.3.50 以降では自動 で ラ ン ダ ム な boundary が 採 用 さ れ る の で 安 全 だ が 、 Ver.3.49 以前は毎回同じ boundary なので危険
  • 15. (2) CGI.pm の CGI:Push ・比較的古くから安全(自動でランダムな boundary を生成) ・念のためソースを確認して boundary がランダムであるこ とを確認する (3) CGI:Simple の multipart_init() ・boundary 指定がある場合の条件は CGI.pm と同じ ・github の 2010 年 11 月 13 日の更新を含むバージョン以降 は boundary 指定無しでも安全
  • 17. まとめ ・ HTTP レスポンス分割は HTTP ヘッダインジェクション だけじゃない。 ・ MIME の boundary は中身が予想できないならランダム にするのが正しいあり方。実際、メールクライアントはほ とんどがそのように実装されている。 ・安全なサンプルコードが少ないので注意。