ncコマンドで指定されたIPアドレス、ポートに接続します。接続するとLast voteということで2つの大きな数値のペアが表示されます。e-VotingOrganizers use this application for votes encryption. Each vote is a piece of data that looks like [‘ID’: x; ‘VOTE’: ‘ctfzone{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}’], where ID – user identifier, VOTE – elector identifier.
We were informed that one user managed to vote for one candidate several times. Unfortunately, we cannot decrypt the votes and organizers refuse to assist. Please, help to understand who has this guy voted for.
The security of this cryptosystem is based on the difficulty of finding discrete logarithms modulo a large prime. The system parameters consist of a prime P and an integer G, whose powers modulo P generate a large number of elements, as in Diffie-Hellman. Application has next functions:
Encrypt: encrypt(int(ptext, 16))
Decrypt: format(decrypt(int(ctext)), "x")
82.202.204.134:1331
$ nc 82.202.204.134 1331続いてOptionsが表示されプロンプトが表示されます。EncryptとDecryptを選ぶことができます。
Last vote: (82188365673110268294064121870080991705755725832546920062792095122208625769242 67718166941006068151871250413947876704800913199138538561553560012641121082386)
Decryptでは2つの数値の入力を受け付けて復号した結果を出力してくれます。Last voteの値をDecryptに入力しても復号してくれません。いくつか試してみて復号結果に法則がないか調べてみます。Decryptに入力する2つの数値のうち左側の値を1、2、3、…と変えていき、右側の値をLast voteの右側の値に固定してみます。Options:[E]ncrypt message[D]ecrypt message[Q]uit
->
-> D
1 677181669410060681518712504139478767048009131991385385615535600126411210823865139dc16987b83af680aefa2af8d742d4593ebdfd5cbad6c7352738761e2f951
2で試してみます。36739570011310345175058857194182124591023784382870723901126672546510051408209…(a)
2 67718166941006068151871250413947876704800913199138538561553560012641121082386a273b82d30f7075ed015df455f1ae85a8b27d7bfab975ad8e6a4e70ec3c5f2a2
3で試してみます。73479140022620690350117714388364249182047568765741447802253345093020102816418
3 6771816694100606815187125041394787670480091319913853856155356001264112108238636ff256206ed2118a8166800eb5f3ec529fb64960a2da98198ceb2b2239bf80c
4で試してみます。24875697832433900686586101358018082885574625713735199599830086245078003349516
4 67718166941006068151871250413947876704800913199138538561553560012641121082386883901789f68a4c8102157a39aecb2f26f8f5075dff956ee0c212639857ef15d
61615267843744245861644958552200207476598410096605923500956758791588054757725
Last vote: (82188365673110268294064121870080991705755725832546920062792095122208625769242…(c) 67718166941006068151871250413947876704800913199138538561553560012641121082386)
a = 36739570011310345175058857194182124591023784382870723901126672546510051408209
b = 85343012201497134838590470224528290887496727434876972103549931394452150875111
c = 82188365673110268294064121870080991705755725832546920062792095122208625769242d = a * c % be = '%x' % dprint(e)
fc575129f3935d5b456ed55ef8173574
ctfzone{fc575129f3935d5b456ed55ef8173574}









