VolgaCTF 2018 Quals Writeup for Button Spy (250)
æè¿ãpwnã«ã¯ã¾ã£ã¦ãã¦ãkatagaitaiåå¼·ä¼ã®è³æãèªã¿æ¼ã£ããhopperè²·ã£ã¦ãã¤ããªã¨ã³ã¸ã§ã¤ãã¦ãDltnã§ãã
ãã¤ããªæ¬²ãé«ã¾ã£ã¦ããã®ã§ãéå»åã ããããªãã¦é©å½ãªCTFã«åå ãã¦ãã¤ããªåé¡è§£ããããªã¨æã£ã¦ãããã
ã¡ããã©å
é±æ«ã«VolgaCTF 2018ã®Qualsãéå¬ããã¦ããã®ã§ãå°ãã ãåå ãã¾ããã
åå æéã¯ä»äºçã®é½åã§å°ãã ãããªã®ã§ãã¡ããã©å¾ç¹ããããªãã§ReverseãªButton Spyã«çæããã¨ããããªãã¨ã解ããã®ã§ãWriteupæ¸ãã¾ãã
Button Spy
Sometimes even the most sneaky spy needs an activation...
button_spy
ã¾ã¨ã
- straceçã§èµ·åããã¨ããã¼å
¥åãç£è¦ãã¦ãããã¨ãåããã
- ç¹å®ã®ãã¼ã·ã¼ã±ã³ã¹ã§ãã©ãã°ããªã¨æ¨æ¸¬
- gdbã§åãããªããreadé¢æ°ããæ»ã£ã¦ããã¨ããã追ã£ã¦ãã
- ä¸å®æåæ°å ¥åããã¨ç¹å®ã®é¢æ°ãå¼ã°ãããã¨ãåãã (èªåã®ç°å¢ã§ã¯ 0x555555565c87ã§call 0x5555555667f0ãå¼ã°ãã)
- ãã®é¢æ°ã®ä¸ãè¦ãã¨ãæåæ°åã ãå®æ°cmpãè¦ã¤ããã®ã§ãå®æ°ãlinux/input.hã¨ç
§ããåããã¦å¾©å·ããã
- ä¸é¨ãlinux/input.hã¨ä¸è´ããªããã®ããã£ãã®ã§ãæåã§ç´ããããããã¬ã§ãã¤ããªãèªãã°ã0x00c0d2dãããã«æåãã¼ãã«ãããã®ã§ããããåèã«ããã°ããã£ããããããªãã
- 復å·ããã¨ãã©ãã°ã«ãªãã VolgaCTF{Even_1he_be$t_spy_can_rust1}
解ããæã®æµã
- èµ·åãã¦ãä½ãèµ·ããªãããstraceçã§è¦ãã¨ããã¼å ¥åãç£è¦ãã¦ãããã¨ãåããã
- gdbã§èµ·åããã¨ãã¡ã¤ã³ããã»ã¹ãããçµäºãã¡ããã®ã追ããªãã
- set follow-fork-mode parentçã§åããã»ã¹ã追ã£ã¦ã¿ã
- /dev/input/event0ãèªãã§ãããã¨ãåãã
- 調ã¹ãã¨ããããã¼ãã¼ãããã¦ã¹ãªã©ã®æä½ãèªã¿åã£ããå½è£ ãããã§ããããã
- ã³ã³ãã¸ãã§ãç¹å®ã®ãã¼ã·ã¼ã±ã³ã¹ãæ±ãããã¦ãã¦ãããããã©ãã°ã«ãªã£ã¦ãã®ããªã¼ã¨ç®æãã¤ããã
- parent processãgdbã§å®è¡ä¸ã«C-cã§ä¸æããã¨ãreadé¢æ°ã®ä¸ã«ããï¼
- finishã§readãæãã¦ãreadããæ å ±ãã©ãå¦çãã¦ãã®ãåãããªããã¢ã»ã³ãã©ãçºãã¦ããã
- typeãshiftã®æ¼ä¸ãã§ãã¯ãæããã«ã¦ã³ã¿ã¨å®æ°ãæ¯è¼ãã¦ããã³ã¼ãã«ãã©ãçãã
- å®æ°ããã©ãã°æåæ°ã ããã¨ç®æãã¤ããã
- ã«ã¦ã³ã¿ãå®æ°ã«éãããããã§ãã¯é¢æ°ããããã®ãå¼ã°ããã
- é¢æ°å ã«å®æ°cmpã大éã«ãããå®æ°ã¯/dev/input/event0ã§åå¾ã§ãããã¼ã³ã¼ãã表ãã¦ãã£ã½ãã
- é å¼µã£ã¦å¾©å·ãã¦ããã©ãã°ã²ããã
ææ³
æ¥ããããªããã/dev/input/event0ãªã©ã®åå¨ãä»ã¾ã§ç¥ããªãã£ãã®ã§ãåå¼·ã«ãªã£ãã
gdbã使ãç·´ç¿ã«ããªã£ã¦ãç¨ããæ触ã®åé¡ã§ããã
(ãã®å²ã«è§£ãã¦ããã¼ã æ°ãå°ãªãã®ãçµæ§æ°ã«ãªã....)
ã¹ãã©ãã¥ã¼ã³2ã®ã¹ã³ã¢(æ¦ç¸¾)管çãµã¼ãã¹ãä½ã£ã¦ã¿ã
çµç·¯
åä½ã¯PCåãã§ä½ã£ã¦ãã¾ããããä»ä½ã¯ã¹ããåãã«ä½ãã¾ããã
Nintendo Switchã¢ããªããã¹ãã©ãã¥ã¼ã³2ã®æ¦ç¸¾ãè¦ãã¾ããã50試ååããè¦ãã¾ããã
ãããããããããªé½åããã£ã¦ããã®ä»¶æ°ãªã®ã§ãããã
ãã£ãããªã®ã§ãå
¨è©¦ååãä¿åãããã¨æããã¤ã«ã¹ã³ã¢2ãä½ãã¾ããã主ã«èªåç¨ã«ã
誰ãä½ã£ã¦ãããããªã¼ã¨æã£ã¦å¾
ã£ã¦ããã§ããèªåã®æ¤ç´¢åãä½ãã®ãã¾ã ãªãã®ãè¦ã¤ãããªãã£ãã®ã§ä½ãã¾ããã
2017/08/09追è¨: ã¤ã«ã¹ã³ã¢2ã§åå¾ã§ããæ¦ç¸¾ã®ä»¶æ°ã¯ãææ°ã®50試åã ãã§ãããªã®ã§ãå ¨è©¦åãä¿åãã¦ããããå ´åã¯ã50試åãã¬ã¤ããåã«ãæ¹ãã¦åå¾ããå¿ è¦ãããã¾ãã
å é¨ (2017/09/16å çä¿®æ£)
ãã¼ã¿ã®ç»é²æ¹æ³ã¯ã以ä¸ã®2種é¡ãç¨æãã¦ãã¾ãã
JSONãã¡ã¤ã«ã§ç»é²
- results/{battle number}.json ãã¢ãããã¼ããã¦ç»é²
iksm_sessionã使ã£ã¦ç»é²
- ãµã¼ããåæã«APIãå©ãã¦ç»é²
- (ãµã¼ãã¸ã®ã¢ã¯ã»ã¹è² è·ãä¸ããããã«ã1人ã«ã¤ãä¸å®æéã«1åããåå¾ã§ããªãããã«ãã¦ãã¾ããæ¢ã«DBã«ç»é²ããã¦ããã¼ã¿ã¯åå¾ãã¾ããã)
- ãã¬ã¤ãã¦ãããªãã®ã«ä¸å®æéãã¨ã«èªåã§ã¢ã¯ã»ã¹ãããã¿ãããªç¸æå ã®ãµã¼ãã®è² è·ãä¸ãããããªãã¨ã¯è¡ããªãã§ãã ããã
- iksm_sessionã¯æå¹æéãããã¾ãããèªåã§æ´æ°ããæ©è½ãä»ããäºå®ã¯ä¸åããã¾ãããiksm_sessionã使ã£ã¦ã®ç»é²æ¹å¼ã¯ããã®ãã¡å»æ¢ããäºå®ã§ãã
JSONãã¡ã¤ã«ãæ軽ã«ä¿åã§ããã½ãããä½ãã¾ããã
こちらããã©ãããMac, Windows対å¿ãã¦ãã¾ããä½ãã¯éã§ãããiksm_sessionã®å¤ããééãã¦ããªããã°åå¾ã§ããã¯ã.... PRãæè¿ãã¾ããMac㯠ã~/Library/Application Support/iksm-fetcher/resultsã ã«ä¿åããã¾ãã
(ãã®ãã¡ã¤ã«ã¹ã³ã¢2ã«ãJSONãã¡ã¤ã«ã®ã¾ã¨ãã¦ç»é²æ©è½ãã¤ããäºå®....)
使ã£ã¦ã¿ãã人ã¸
ä»ã®ã¨ãããæ¦ç¸¾ã¯ãããªæãã§å
¬éããã¾ããå
¬éãããã®ãå«ãªäººã¯ããã®ãã¡å
¬éè¨å®ã¤ããã®ã§ãããã¾ã§ãå¾
ã¡ä¸ããã 2017/08/09ã«å
¬éè¨å®ã¤ãã¾ããã
2017/08/23追è¨: JSONãã¡ã¤ã«ã§ã®ç»é²ã«å¯¾å¿ããã®ã§ãiksm_sessionç¡ãã§ãå©ç¨ã§ããããã«ãªãã¾ããããã®ä¸ã§iksm_sessionã使ã£ã¦æ¦ç¸¾ãç»é²ãã人ã¯ã以ä¸ã®å 容ã10åãããèªãã§ããªã¹ã¯ããããã ãªã¨ãããã¨ãã¡ããã¨é ã«å ¥ãã¦ãã ããã
iksm_sessionã¯ã大äºãªã»ãã·ã§ã³æ
å ±ãªã®ã§ãå¤é¨ã«æ¼ããã¨ãåæã«ã¹ãã©2ã®æ
å ±ãè¦ãããããã²ã½ã¿ã¦ã³ã§æ³¨æãããå¯è½æ§ãããã¾ãã
任天å ã¨ã¯å
¨ãé¢ä¿ããªããµã¼ãã¹ã§ãã®ã§ãåæã«iksm_sessionãå©ç¨ããã¨ãã¢ã«ã¦ã³ãåæ¢ãªã©ã®å¦ç½®ããªãããå¯è½æ§ãããã¾ãã
ã§ããéãããããããã¨ãèµ·ãããªãããã«é
æ
®ã¯ãã¦ããã¤ãã(éä¿¡ã®æå·åãiksm_sessionã®æå·åç)ã§ãããä½ãèµ·ãããã¯åããã¾ããã
ãã»ãã·ã§ã³ãã¤ã¸ã£ãã¯ãã®æå³ãåãããªã人ã¯ãJSONã§ç»é²ããæ¹ãç¡é£ã§ãã
ã¢ã«ã¦ã³ãç»é²ã«ä½¿ãã¡ã¼ã«ã¢ãã¬ã¹ã¯ããã¹ã¯ã¼ããå¿ããã¨ãç¨ã«ãã使ã£ã¦ã¾ããã
ãªã®ã§ããã¹ã¯ã¼ãå¿ãã¦ãããããã£ã¦äººããå¿ãããã¨ããªã人ã¯ã
hogehoge@example.comã¨ã好ããªã¢ãã¬ã¹ã§ç»é²ãã¦ä½¿ã£ã¦ããã£ããããã¨æãã¾ãã
ããã§ã使ããã人ã¯ãã¡ãããã©ãã
使ç¨ã¯èªå·±è²¬ä»»ã§ãé¡ããã¾ãã
ã¢ã¯ã»ã¹ã®æ§åãè¦ã¦ããã¾ãã«ã¢ã¯ã»ã¹æ°ãå¤ãå ´åã¯ãã¦ã¼ã¶æ°ãiksmã®åå¾ã«å¶éãã¤ããããããã¾ããã
çµæ§ããã¼ããµã¼ãã«ç½®ãã¦ããã®ã§ã人ãæ¼ãããããè½ã¡ãããããã¾ããã
(ãã®ãã¡æ°è¦ç»é²ã¯æ¢ããäºå®ã§ãã)
ãã®ãã¡ã¤ããããã®(å¦æ³)
- æ¦ç¸¾ã®å
¬éè¨å®
試åãã¨ã®çµæã¯ãå ¬éè¨å®ãã¾ã ãªãã®ã§ãèªå以å¤ã®äººã表示ããã¨ãã¬ã¤ã¤ã¼åãä¼ãåã«ãªãã¾ãã2017/08/09 å®è£ ãã¾ããã
- ãã¤ãã¼ã¸
- çµ±è¨è¡¨ç¤ºï¼
é£åè¨é²å®è£ æ¸ãæ¦å¨ãããããã«ã¼ã«ãK/Dãå¡pãä»ãä½ãé¢ç½ãããªã®ããã°ã³ã¡ã³ããã ããï¼
- çµ±è¨è¡¨ç¤ºï¼
- å¥ã®äººã¨ã®æ¯è¼æ©è½
- ç»é²è å ã§ã®ã©ã³ãã³ã°çãªä½ãï¼å¡ãpã試åæ°ãåå©æ°ãetc)
ä»æ¥ã®æ¦ç¸¾çãªãã®ãTwitterçã«è²¼ãããããªä½ãå®è£ æ¸
OS Xã§gpg2ã§ã¯ãªãgpg1ã使ãããã®æé
MacBookãæ°èª¿ããã®ã§ãããbrew install gpgããã¨ãgpg2ãã¤ã³ã¹ãã¼ã«ãããããã«ãªã£ã¦ãã¾ããã
gpg2ã§ãã°ãã使ã£ã¦ãããã§ãããä½æ
ãçªç¶ãpinentry-macããã¹ãã¬ã¼ãºã®å
¥åãåä»ããªãç¶æ
ã«ãªã£ã¦ãã¾ãã¾ãã....
ãããããterminalä¸ã§å®çµããããã®ã§ããã¡ãã¡ã¦ã£ã³ãã¦ä¸ã§å
¥åããã®ãè¾ãã
調ã¹ã¦ã¿ãã¨ãç´ ç´ã«gpg1ã«æ»ããæ¹ãæã£åãæ©ããã ã£ãã®ã§ãgpg1ã«ãã¦ã³ã°ã¬ã¼ããããã¨ã«ãã¾ããã
brew install gpg1 ã ãã ã¨ãgpgã³ãã³ãã¸ã®ãã¹ãè²¼ãããã
brew link gpg1 ã¨ãã¦ãã
Warning: Already linked: /usr/local/Cellar/gnupg@1.4/1.4.21
ã¨åºãã ãã
ãªã®ã§ã
ln -s /usr/local/Cellar/gnupg@1.4/1.4.21/bin/gpg1 /usr/local/bin/gpg
ã¨ãã¦ãããã¨ã§ãç¡äºã«gpgã³ãã³ããèªèãã¦ããã¾ããã
çããã¯gpg2ã§é å¼µã£ã¦ãã£ãããã®ã§ãããã.... (èªåã¯1æ¥ã§ã®ãã§ããã)
åä½å¤ãå³é¸ããããã«ãã±ã¢ã³GOã®ã¬ãã«ç¢ºèªç¨ã®å度å¨ãWebã§ä½ã£ãã
åä½å¤ã®æ¸¬ãæ¹ãæ¢ãã¦ãããã次ã®è¨äºãè¦ã¤ãã¾ããã
【ポケモンGO】個体値厳選のやり方 〜レベル確認用分度器作成のススメ〜 - bohemia日記
ãã®è¨äºãèªãã§ãåä½å¤ã®æ¸¬ãæ¹ã¯åãã£ããã§ããã
å度å¨ã»ã»ã»ããæå
ã«ãªãã»ã»ã»(ï¾Ð`)シクシク
ãªã®ã§ãiPhoneã§ã¢ãããããéãã¦è¡¨ç¤ºãã¦ããããã¤ãä½ãã¾ããã
ãã¡ããã使ãã¾ãã
iPhone5ãiPhoneSEã¯ä½ç½®èª¿æ´ãã·ã§ä½¿ãã¾ããã
ä»ã®è§£å度ã ã¨å¾®å¦ã«ãã¿ã³ã§ä½ç½®èª¿æ´ããªãã¨ããã¾ããã
弧ã®æç»ã¯ https://jackhumbert.github.io/poke-rater/ ã®ã³ã¼ãã使ã£ã¦ã¾ãã
CTFã®åé¡ã®ä½ãæ¹
ãã®è¨äºã¯SLP KBIT Advent Calendar 2015ã®25æ¥ç®ã§ãã
æ¨æ¥ã¯ãªããããããæ¸ãã¾ããã
æ¬å½ã¯Fluxã®ã¢ã¼ããã¯ãã£ã¨å®è£
ã«ã¤ãã¦æ¸ããã¨æã£ããã§ããã
ããã£ããåãããããè³æãåºã¾ãã£ã¦ã¦ãä»æ´è©±ããã¨ããªãããªã¨æã£ãã®ã§ã
CTFã®åé¡ã®ä½ãæ¹ãç´¹ä»ãããã¨ã«ãã¾ããã
ãã¾ãé£ããåé¡ã®ä½æã«ã¯å½ã¦ã¯ã¾ããªãããã
åé¡ã®ä½ãæãå
¨å¡åãããã«ä½ã£ã¦ããã¨ã¯éããªãã§ããã
極端ãªã¨ã¹ãã¼åé¡ãé²ãã ããåå ããå´ã«ã¨ã£ã¦ã¯ã
ããã¹ãã¼ãªã¼ãèæ¯ã楽ãããããã«ãªãã°å¹¸ãã§ãã
SECCON 2015 Online CTF Writeup(WebQR)
TMCTFã«å¼ãç¶ããã¬ãããªCTFåå ãã¾ããã
ãã¾ãWriteupãè¦å½ãããªãWebQRã ãWriteupæ¸ãã¾ãã
(ã¨è¨ã£ã¦ãããã ããããã ãã®åé¡ãªã®ã§ãããã)
ã¹ãã©ãã¥ã¼ã³ã®ã¹ã³ã¢ç®¡çãµã¼ãã¹ããªãã¥ã¼ã¢ã«
ååã®è¨äºã«è¨è¼ãã¦ãããã¹ãã©ãã¥ã¼ã³ã®ã¹ã³ã¢ç®¡çãµã¼ãã¹ããªãã¥ã¼ã¢ã«ãã¾ããã
- ãµã¤ãåããã¤ã«ã¹ã³ã¢ãã«å¤æ´
- ã¬ã¤ã¢ã¦ããä¸æ°
- ã¬ãã¨ãªã¢ã«ã¤ãã¦ã¯KDæ¯ã«ããåæãè¡ããããããã«ã°ã©ãçã追å
- ã¬ããã³å¯¾å¿
- æ¦å¨ã»ããããã¨ã®å®å®åº¦ã追å