[レポート] SEC402 – AWS, I Choose You: Pokemon’s Battle Against the Bots( キミにきめた!Bot たちとポケモンの戦い ) #reinvent

re:Invent 2018 のセッション SEC402 - AWS, I Choose You: Pokemon's Battle against the Bots( キミにきめた! Bot たちとポケモンの戦い ) のレポートです。
2018.12.30

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

こんにちは。池田です。本記事は現地時間2018/11/26-30で行われた re:Invent 2018 のセッション SEC402-R1 - [REPEAT 1] AWS, I Choose You: Pokemon's Battle against the Bots( キミにきめた! Bot たちとポケモンの戦い )のレポートです。

概要

Join us for this advanced-level talk to learn about Pokemon's journey defending against DDoS attacks and bad bots with AWS WAF, AWS Shield, and other AWS services. We go through their initial challenges and the evolution of their bot mitigation solution, which includes offline log analysis and dynamic updates of badbot IPs along with rate-based rules. This is an advanced talk and assumes some knowledge of Amazon DynamoDB, Amazon Kinesis Data Firehose, Amazon Kinesis Data Analytics, AWS Firewall Manager, AWS Shield, and AWS WAF.

動画・資料

このセッションに現地で参加した武田のレポート記事も公開されていますのでこちらもご覧ください。

[レポート] AWS キミにきめた!:ポケモン対Bot戦 #reinvent #SEC402

セッション資料は以下に公開されています。
動画YouTube

登壇者

Sundar Jayashekar - Senior Product Manager, AWS
David Williams - Sr Devops Engineer, The Pokemon Company International
Edward Smith - Senior DevOps Engineer, The Pokemon Company International

Agenda

最初に Sundar Jayashekar - Senior Product Manager, AWS による本セッションに関する紹介。

  • Are bots a problem?
  • The Pokémon story
  • Live demo
  • Conclusion

Are bots a problem?

Bad bots—Why are they bad?

  • Denial of service
  • Content scraping
  • Account takeover
  • Unfair advantage
  • Economic incentive ... and more!

セッション会場で「ボットに関する問題を扱ったことのある人」という問いに対して40-50%ほどが挙手したようで、このテーマへの関心の高さが伺えます。ここではボットによって引き起こされる DoS 攻撃を始めとしたいくつもの問題について整理されていました。

What to expect from this session

  • Pokémon bot challenge
  • Initial solution
  • New challenges
  • Evolution of solution
  • How to scale and improve performance
  • Applying solutions to the real world

ボットも日々進化するため、今までに行なった対策では解決しきれなかったことが、これから話す内容で解決できた。そのエキサイティングな進化を(セッション参加者は)見ることができる。とのコメント。それだけ苦労していた問題が解決できたということなのでしょう。実際、様々な場面でボット対策はいたちごっこに陥りがちで担当するエンジニアのライフやマジックポイントをじわじわと削っていくものですよね...

Quick service intros

  • AWS Services we cover in this session
    • Amazon CloudFront
    • AWS WAF
    • AWS Shield
    • AWS Lambda
    • Amazon Kinesis
    • Amazon Kinesis Data Firehose
    • Amazon Kinesis Data Analytics
    • Amazon DynamoDB
    • Amazon Simple Queue Service (Amazon SQS)

利用している主なサービスの紹介がありました。

The Pokémon story

ここからは David Williams - Sr Devops Engineer, The Pokemon Company International による解説です。

The Pokémon Trainer Club

  • Worldwide authentication service
  • Access to various Pokémon games and services
  • Security of child accounts is our top priority

やはり、子供が安心安全に楽しめるためにもセキュリティ対策は最優先事項だったようです。

The Pokémon bot challenge

  • Massive increase in new users
  • Massive, disproportional increase in illegitimate users and traffic
    • Bots
    • Scanners
    • DDoS attacks

新規ユーザーの増加だけならともかく、不正行為やボット、スキャナーによるトラフィックの増加に加えて DDos 攻撃とシステムを正常に維持、サービスの安定提供を行う側にとってはどれも頭を悩ますことも増加したとのこと。

The ongoing saga - Our continuing problem

  • When we last left our team
    • Switch to CloudFront + AWS WAF & Shield improved stability and performance
    • Improved support and response from Shield DRT team
    • Our talk from Re:Invent 2017: https://bit.ly/2IRCjGn

実は昨年2017年の re:Invent でもポケモンと bot の戦いについて触れたセッションがありました。

ちなみに、そのセッションレポートは以下です。

クラウドにおけるDDoS対応の自動化について理解する #SID324 #reinvent

CloudFront serverless analytics

Amazon Big Data blog から CloudFront を利用したサーバーレスなアクセスログ分析手法を見つけたとのこと。

Next level challenges

減るどころかいつまでも増える不正行為と bot や DDoS 攻撃にどう対処すべきか検討していった話題になります。

Choosing our weapons

ここからは(紹介はなかったのですが)Edward Smith - Senior DevOps Engineer, The Pokemon Company International による新たな武器の紹介に入ります。

  • Make bad behavior expensive
  • Reduce risk of false positives
  • Set and forget
  • Audit trail
  • All serverless
  • So much scale
  • Fast to implement

上記をゴールと設定して最初に構築したのが以下のスライドにある構成とのことです。

そこでボットに対して有効な結果を得られたものを収集、処理、保管というサイクルを繰り返すことでよりよい構成を見つけながらチューニングを重ね、以下へたどり着いたようです。

Blasting off Again Our Next Steps

ホワイトリストを方式を採用しているうえでの問題点などは現状、Amazon DynamoDB を利用することで解決できているようですが、Advanced behaviors として次が挙げられています。

  • Additional IP information
  • Repeated offenses, harsher penalties
  • Misbehaving subnets?
  • Minute, hourly, and daily based limits

セッション資料では Flow walkthrough & demo としてデモに関する設定資料に続いて、当日のセッション中に行われたデモへのリンクが記載されていましたが、残念ながら現在はアクセスできない状態となっていました(当たり前といえば当たり前ですね)が、動画では 41分40秒頃から再び David Williams が登場してデモに際する設定の解説を行い、David Williams による補足説明と来場者との Q&A を行なっています。
デモの内容は、スクリーンに映し出された URL へ30秒以内に2回アクセスしようとするとその IP アドレスはブラックリストに登録され、2度目のアクセスからは 403 error が返される仕組みだったようです。

Key takeaways

  • Bots are a problem!
  • AWS offers many weapons to choose from
  • AWS allows you to customize the solution
  • Evolve your solution, because the bots are
  • Now, go try your own solution!

サービス開始からボットに悩まされ、苦労させられ続けている心の叫びが聞こえてきそうなまとめですが(笑)、AWS は多くの(ボットなどと戦い打ち勝つための)武器を提供している。という表現はなるほどな。と感じました。

おわりに

様々な苦労を乗り越えて楽しいサービスを安全に利用できるよう弛まぬ努力を続けてくれているエンジニアがいるからこそ、私たちもゲームを楽しめる訳です。これからは既に捕まえているモンスターであっても感謝の気持ちを込めたカーブボールでゲットしていこうと思います。