Pro Yearly is on sale from $80 to $50! »

BadUSBを作ろう / how to make your own BadUSB and Keyboard

6a87c9bfc71c805c3f5f248b359365d3?s=47 mu2in
June 29, 2019

BadUSBを作ろう / how to make your own BadUSB and Keyboard

BadUSBを作ってみた話です。

「オープンセミナー2019@岡山 懇親会」でのLT資料です。 https://oso.connpass.com/event/129843/

6a87c9bfc71c805c3f5f248b359365d3?s=128

mu2in

June 29, 2019
Tweet

Transcript

  1. #BE64#Λ࡞Ζ͏ʂ Φʔϓϯηϛφʔ!Ԭࢁ࠙਌ձ

  2. ‣ @mu2in ‣ JavaΤϯδχΞ6೥໨ ‣ ޷͖ͳϓϩάϥϛϯάݴޠɿJavaScript ‣ ࢀՃίϛϡχςΟ ▹ ͍͢͝޿ౡ

    (ਫ༵΋͘΋͘ձ) ओ࠵ ▹ PyCon mini Hiroshima 2019 ▹ Φʔϓϯηϛφʔ2020@޿ౡ ࣗݾ঺հ
  3. BadUSBͱ͸ ‣ USBϙʔτʹૠ͚ͩ͢ͰPCյͤΔ΍ͭ

  4. BadUSBͱ͸ ‣ USBϙʔτʹૠ͚ͩ͢ͰPCյͤΔ΍ͭ ▹ ͦΕ͸USB Killer

  5. BadUSBͱ͸ ‣ 2014೥8݄ʹ։ൃऀձٞ Black Hat 2014 USAͰ ൃද͞Εͨ߈ܸख๏ ▹ USBͷϑΝʔϜ΢ΣΞΛॻ͖׵͑Δ͜ͱʹΑͬͯɺෆਖ਼ͳ

    ϓϩάϥϜΛ࣮ߦ͢Δ͜ͱ͕Ͱ͖Δɻ ▹ Өڹ͕େ͖͍ͨΊɺ࣮ূίʔυΛެ։͞Ε͍ͯͳ͔ͬͨɻ ‣ ཌ݄ͷ9݄ʹߦΘΕͨηΩϡϦςΟձٞͷ DerbyCon 4.0 Ͱผͷݚڀऀ͕GitHubʹެ։ ▹ USBΩʔϘʔυͷϑΝʔϜ΢ΣΞΛॻ͖׵͑ͯɺ
 উखʹΩʔΛೖྗͤ͞ΔσϞ͕ߦΘΕͨɻ
  6. Ͱ͸࡞ͬͯΈ·͠ΐ͏

  7. ༻ҙ͢Δ΋ͷ • CJMCU Beetle ▹ Arduino Leonardoޓ׵ͷϚΠίϯ • HID(ώϡʔϚϯΠϯλʔϑΣʔεσ όΠε)ͱͯ͠ৼ෣͏͜ͱ͕Ͱ͖Δ

    • USBΦε͕෇͍ͯΔͨΊ௚ૠ͠Մೳ • ී௨ͷUSBϝϞϦΑΓ΋খ͍͞ • AmazonͰ¥1,000 தࠃ௚༌ೖ¥300
  8. ϚΠίϯʹBadUSBͷίʔυΛॻ͖ࠐΉ

  9. USBΛૠ͚ͩ͢ͰϩάΞ΢τ

  10. ͜ΕͰօ͞Μ΋#BE64#͕࡞Ε·͢ʂ

  11. ण࢘ΩʔϘʔυΛ࡞Ζ͏ʂ

  12. • Ruby Kaigi 2017Ͱ໯ͬͨण࢘ΩʔΩϟοϓ
 ( Misoca͞ΜϒʔεΑΓ ) • CJMCU Beetle

    • Cherry MXΩʔεΠον • Cherry MX Switch Breakout • μΠΦʔυɺ఍߅ • ϐϯϔομ • LED • δϟϯύʔϫΠϠʔ • ϒϨουϘʔυ ༻ҙ͢Δ΋ͷ
  13. ૊ΈཱͯΔ

  14. #include <Keyboard.h> #define PIN_KEYSW (0) int preState; int currentState; void

    setup() { pinMode(PIN_KEYSW, INPUT); preState = HIGH; Keyboard.begin(); } void loop() { currentState = digitalRead(PIN_KEYSW); if((currentState != preState) && (currentState == HIGH)) { Keyboard.press(KEY_LEFT_ALT); Keyboard.print("d83c"); Keyboard.print("df63"); delay(10); Keyboard.releaseAll(); } preState = currentState; delay(10); } ण࢘ΩʔϘʔυͷίʔυΛॻ͖͜Ή Ωʔ͕ԡ͞ΕͨΒ 6OJDPEFೖྗͰ ͷαϩήʔτϖΞΛೖྗ
  15. MacͷೖྗιʔεΛมߋ

  16. ण࢘ΩʔΛಈ͔͢

  17. ·ͱΊ ‣ BadUSB͸ૠ͚ͩ͢ͰΩʔೖྗΛ࣮ߦͰ͖ͯɺ ϚΫϩʹศརɻ ‣ ࣗ࡞ΩʔϘʔυ࡞Γ௒ָ͍͠ɻ ‣ ৭ΜͳΩʔϘʔυ࡞Γ͍ͨʢপʣ ‣ ѱ͍USB͚ͩͲɺ࢖͍ํ࣍ୈͰ৭ʑͳ͜ͱ͕

    Ͱ͖Δͧʂ