This commit is contained in:
Triggered_Tux 2019-01-23 12:01:27 -05:00
parent e6774e9e33
commit c9360587cb
35 changed files with 3191 additions and 0 deletions

View File

@ -0,0 +1,32 @@
# Rhme-2016
## Challenge Binaries
You can use the challenge binaries on a normal Arduino Nano or Uno board (atmega328p chip). To upload the challenge to the board, use the following command:
avrdude -c arduino -p atmega328p -P /dev/ttyUSB* -b115200 -u -V -U flash:w:CHALLENGE.hex
Please keep in mind that depending on the bootloader that is installed on your board, the baudrate will change. Stock Nano baudrate should be 57600, and stock Uno is 115200. (Thanks [HydraBus]kag for this info).
## Write-ups
* https://github.com/hydrabus/rhme-2016
* https://www.balda.ch/posts/2017/Mar/01/rhme2-writeup/
* https://www.youtube.com/playlist?list=PLhixgUqwRTjwNaT40TqIIagv3b4_bfB7M
* https://ctf.rip/rhme2-secretsauce/
* https://ctf.rip/rhme2-fridgejit/
* https://github.com/mrmacete/writeups/tree/master/rhme2/fridge-plugin
* https://github.com/gijsh/rhme2_writeups
* https://www.youtube.com/watch?v=6_Z5RcHoykE
* https://n0wblog.blogspot.nl/2017/03/rhme2-writeups-secure-filesystem.html
* https://n0wblog.blogspot.nl/2017/03/rhme2-writeups-jumpy.html
* https://github.com/ikizhvatov/jlsca-tutorials
* https://firefart.at/post/rhme2_whac_the_mole/
## Old readme
The second round is coming!
The RHme2 (Riscure Hack me 2) is our low level hardware CTF challenge that comes in the form of an Arduino Nano board. The new edition provides a completely different set of new challenges to test your skills in side channel, fault injection, cryptoanalysis and software exploitation attacks.
For more information and registration, visit http://rhme.riscure.com
Follow us on twitter at @riscure and #rhme2 for updates.

Binary file not shown.

View File

@ -0,0 +1,2 @@
After decades of research, we have finally managed to catalogue all
the animals on the planet earth. Including very rare pictures!

View File

@ -0,0 +1,26 @@
We don't remember why, but we wanted a file system on an
AVR328p. After the system was completed we discovered that it lacked
basic security. A couple of beers later we came up with what we think
is a revolutionary way to do file system permissions. It is now your
task to fill in our shoes and test its security.
The filesystem allows you to request the contents of one or more
available files by using the following format:
token#<filename>[:<filename>]
So for example, a request would be:
933d86ae930c9a5d6d3a334297d9e72852f05c57#cat.txt:finances.csv
Some example files (token | call):
96103df3b928d9edc5a103d690639c94628824f5 | cat.txt
933d86ae930c9a5d6d3a334297d9e72852f05c57 | cat.txt:finances.csv
83f86c0ba1d2d5d60d055064256cd95a5ae6bb7d | cat.txt:finances.csv:joke.txt
ba2e8af09b57080549180a32ac1ff1dde4d30b14 | cat.txt:joke.txt
0b939251f4c781f43efef804ee8faec0212f1144 | finances.csv
4b0972ec7282ad9e991414d1845ceee546eac7a1 | finances.csv:joke.txt
715b21027dca61235e2663e59a9bdfb387ca7997 | joke.txt
Can you access any file you're not supposed to?

View File

@ -0,0 +1,25 @@
import serial
ser = serial.Serial("COM7", 19200, timeout=0.1)
#def read_until(until):
# out = ()
# while 'until' != 'out':
# out = (ser.read(1000))
# return out
def read_until(something):
output = ()
while something not in output:
output = (ser.read(124000))
#print (output)
return output
print ("__Attente de la réponse du board")
print ((read_until(b'>>')).decode())
ser.write(('933d86ae930c9a5d6d3a334297d9e72852f05c57#cat.txt:finances.csv\r\n').encode())
print ("__Attaque")
print ("__Attente de la réponse après l'attaque")
print (((read_until(b'\r\n\r\n'))).decode())

View File

@ -0,0 +1,375 @@
Time [s], Analyzer Name, Decoded Protocol Result
3.352752850000000,Async Serial,\r (0x0D)
3.353272540000000,Async Serial,\n (0x0A)
3.353792220000000,Async Serial,\r (0x0D)
3.354311910000000,Async Serial,\n (0x0A)
3.354831600000000,Async Serial,R (0x52)
3.355351280000000,Async Serial,H (0x48)
3.355870970000000,Async Serial,M (0x4D)
3.356390650000000,Async Serial,e (0x65)
3.356910340000000,Async Serial,O (0x4F)
3.357430030000000,Async Serial,S (0x53)
3.357949710000000,Async Serial,' ' (0x20)
3.358469400000000,Async Serial,f (0x66)
3.358989080000000,Async Serial,i (0x69)
3.359508770000000,Async Serial,l (0x6C)
3.360028460000000,Async Serial,e (0x65)
3.360548140000000,Async Serial,' ' (0x20)
3.361067830000000,Async Serial,A (0x41)
3.361587510000000,Async Serial,P (0x50)
3.362107200000000,Async Serial,I (0x49)
3.362626890000000,Async Serial,\r (0x0D)
3.363146570000000,Async Serial,\n (0x0A)
3.363666260000000,Async Serial,F (0x46)
3.364185940000000,Async Serial,i (0x69)
3.364705630000000,Async Serial,l (0x6C)
3.365225320000000,Async Serial,e (0x65)
3.365745000000000,Async Serial,s (0x73)
3.366264690000000,Async Serial,' ' (0x20)
3.366784370000000,Async Serial,i (0x69)
3.367304060000000,Async Serial,n (0x6E)
3.367823750000000,Async Serial,' ' (0x20)
3.368343430000000,Async Serial,s (0x73)
3.368863120000000,Async Serial,y (0x79)
3.369382800000000,Async Serial,s (0x73)
3.369902490000000,Async Serial,t (0x74)
3.370422180000000,Async Serial,e (0x65)
3.370941860000000,Async Serial,m (0x6D)
3.371461550000000,Async Serial,: (0x3A)
3.371981240000000,Async Serial,\r (0x0D)
3.372500920000000,Async Serial,\n (0x0A)
3.373020610000000,Async Serial,\r (0x0D)
3.373540290000000,Async Serial,\n (0x0A)
3.374059980000000,Async Serial,d (0x64)
3.374579670000000,Async Serial,r (0x72)
3.375099350000000,Async Serial,w (0x77)
3.375619040000000,Async Serial,x (0x78)
3.376138720000000,Async Serial,r (0x72)
3.376658410000000,Async Serial,w (0x77)
3.377178100000000,Async Serial,x (0x78)
3.377697780000000,Async Serial,r (0x72)
3.378217470000000,Async Serial,- (0x2D)
3.378737160000000,Async Serial,x (0x78)
3.379256840000000,Async Serial,' ' (0x20)
3.379776530000000,Async Serial,r (0x72)
3.380296210000000,Async Serial,e (0x65)
3.380815900000000,Async Serial,m (0x6D)
3.381335580000000,Async Serial,o (0x6F)
3.381855270000000,Async Serial,t (0x74)
3.382374960000000,Async Serial,e (0x65)
3.382894640000000,Async Serial,' ' (0x20)
3.383414330000000,Async Serial,r (0x72)
3.383934020000000,Async Serial,e (0x65)
3.384453700000000,Async Serial,m (0x6D)
3.384973390000000,Async Serial,o (0x6F)
3.385493070000000,Async Serial,t (0x74)
3.386012760000000,Async Serial,e (0x65)
3.386532450000000,Async Serial,' ' (0x20)
3.387052130000000,Async Serial,4 (0x34)
3.387571820000000,Async Serial,0 (0x30)
3.388091510000000,Async Serial,9 (0x39)
3.388611190000000,Async Serial,6 (0x36)
3.389130880000000,Async Serial,' ' (0x20)
3.389650560000000,Async Serial,s (0x73)
3.390170250000000,Async Serial,e (0x65)
3.390689940000000,Async Serial,p (0x70)
3.391209620000000,Async Serial,' ' (0x20)
3.391729310000000,Async Serial,' ' (0x20)
3.392248990000000,Async Serial,1 (0x31)
3.392768680000000,Async Serial,' ' (0x20)
3.393288370000000,Async Serial,. (0x2E)
3.393808050000000,Async Serial,\r (0x0D)
3.394327740000000,Async Serial,\n (0x0A)
3.394847420000000,Async Serial,d (0x64)
3.395367110000000,Async Serial,r (0x72)
3.395886800000000,Async Serial,w (0x77)
3.396406480000000,Async Serial,x (0x78)
3.396926170000000,Async Serial,r (0x72)
3.397445850000000,Async Serial,w (0x77)
3.397965540000000,Async Serial,x (0x78)
3.398485230000000,Async Serial,r (0x72)
3.399004910000000,Async Serial,- (0x2D)
3.399524600000000,Async Serial,x (0x78)
3.400044290000000,Async Serial,' ' (0x20)
3.400563970000000,Async Serial,r (0x72)
3.401083660000000,Async Serial,e (0x65)
3.401603340000000,Async Serial,m (0x6D)
3.402123030000000,Async Serial,o (0x6F)
3.402642720000000,Async Serial,t (0x74)
3.403162400000000,Async Serial,e (0x65)
3.403682090000000,Async Serial,' ' (0x20)
3.404201780000000,Async Serial,r (0x72)
3.404721460000000,Async Serial,e (0x65)
3.405241150000000,Async Serial,m (0x6D)
3.405760830000000,Async Serial,o (0x6F)
3.406280520000000,Async Serial,t (0x74)
3.406800210000000,Async Serial,e (0x65)
3.407319890000000,Async Serial,' ' (0x20)
3.407839580000000,Async Serial,4 (0x34)
3.408359260000000,Async Serial,0 (0x30)
3.408878950000000,Async Serial,9 (0x39)
3.409398640000000,Async Serial,6 (0x36)
3.409918320000000,Async Serial,' ' (0x20)
3.410438010000000,Async Serial,s (0x73)
3.410957700000000,Async Serial,e (0x65)
3.411477380000000,Async Serial,p (0x70)
3.411997070000000,Async Serial,' ' (0x20)
3.412516750000000,Async Serial,' ' (0x20)
3.413036440000000,Async Serial,1 (0x31)
3.413556130000000,Async Serial,' ' (0x20)
3.414075810000000,Async Serial,. (0x2E)
3.414595500000000,Async Serial,. (0x2E)
3.415115180000000,Async Serial,\r (0x0D)
3.415634870000000,Async Serial,\n (0x0A)
3.416154560000000,Async Serial,- (0x2D)
3.416674240000000,Async Serial,r (0x72)
3.417193930000000,Async Serial,- (0x2D)
3.417713610000000,Async Serial,- (0x2D)
3.418233300000000,Async Serial,r (0x72)
3.418752990000000,Async Serial,- (0x2D)
3.419272670000000,Async Serial,- (0x2D)
3.419792360000000,Async Serial,r (0x72)
3.420312040000000,Async Serial,- (0x2D)
3.420831730000000,Async Serial,- (0x2D)
3.421351420000000,Async Serial,' ' (0x20)
3.421871100000000,Async Serial,r (0x72)
3.422390790000000,Async Serial,e (0x65)
3.422910480000000,Async Serial,m (0x6D)
3.423430160000000,Async Serial,o (0x6F)
3.423949850000000,Async Serial,t (0x74)
3.424469530000000,Async Serial,e (0x65)
3.424989220000000,Async Serial,' ' (0x20)
3.425508910000000,Async Serial,r (0x72)
3.426028590000000,Async Serial,e (0x65)
3.426548280000000,Async Serial,m (0x6D)
3.427067970000000,Async Serial,o (0x6F)
3.427587650000000,Async Serial,t (0x74)
3.428107340000000,Async Serial,e (0x65)
3.428627020000000,Async Serial,' ' (0x20)
3.429146710000000,Async Serial,' ' (0x20)
3.429666400000000,Async Serial,' ' (0x20)
3.430186080000000,Async Serial,8 (0x38)
3.430705770000000,Async Serial,7 (0x37)
3.431225460000000,Async Serial,' ' (0x20)
3.431745140000000,Async Serial,s (0x73)
3.432264830000000,Async Serial,e (0x65)
3.432784510000000,Async Serial,p (0x70)
3.433304200000000,Async Serial,' ' (0x20)
3.433823890000000,Async Serial,1 (0x31)
3.434343570000000,Async Serial,4 (0x34)
3.434863260000000,Async Serial,' ' (0x20)
3.435382940000000,Async Serial,c (0x63)
3.435902630000000,Async Serial,a (0x61)
3.436422320000000,Async Serial,t (0x74)
3.436942000000000,Async Serial,. (0x2E)
3.437461690000000,Async Serial,t (0x74)
3.437981370000000,Async Serial,x (0x78)
3.438501060000000,Async Serial,t (0x74)
3.439020750000000,Async Serial,\r (0x0D)
3.439540430000000,Async Serial,\n (0x0A)
3.440060120000000,Async Serial,- (0x2D)
3.440579800000000,Async Serial,r (0x72)
3.441099490000000,Async Serial,- (0x2D)
3.441619180000000,Async Serial,- (0x2D)
3.442138860000000,Async Serial,r (0x72)
3.442658550000000,Async Serial,- (0x2D)
3.443178240000000,Async Serial,- (0x2D)
3.443697920000000,Async Serial,r (0x72)
3.444217610000000,Async Serial,- (0x2D)
3.444737290000000,Async Serial,- (0x2D)
3.445256980000000,Async Serial,' ' (0x20)
3.445776670000000,Async Serial,r (0x72)
3.446296350000000,Async Serial,e (0x65)
3.446816040000000,Async Serial,m (0x6D)
3.447335720000000,Async Serial,o (0x6F)
3.447855410000000,Async Serial,t (0x74)
3.448375100000000,Async Serial,e (0x65)
3.448894780000000,Async Serial,' ' (0x20)
3.449414470000000,Async Serial,r (0x72)
3.449934160000000,Async Serial,e (0x65)
3.450453840000000,Async Serial,m (0x6D)
3.450973530000000,Async Serial,o (0x6F)
3.451493210000000,Async Serial,t (0x74)
3.452012900000000,Async Serial,e (0x65)
3.452532590000000,Async Serial,' ' (0x20)
3.453052270000000,Async Serial,' ' (0x20)
3.453571960000000,Async Serial,' ' (0x20)
3.454091640000000,Async Serial,4 (0x34)
3.454611330000000,Async Serial,7 (0x37)
3.455131020000000,Async Serial,' ' (0x20)
3.455650700000000,Async Serial,s (0x73)
3.456170390000000,Async Serial,e (0x65)
3.456690080000000,Async Serial,p (0x70)
3.457209760000000,Async Serial,' ' (0x20)
3.457729450000000,Async Serial,1 (0x31)
3.458249130000000,Async Serial,6 (0x36)
3.458768820000000,Async Serial,' ' (0x20)
3.459288510000000,Async Serial,f (0x66)
3.459808190000000,Async Serial,i (0x69)
3.460327880000000,Async Serial,n (0x6E)
3.460847560000000,Async Serial,a (0x61)
3.461367250000000,Async Serial,n (0x6E)
3.461886940000000,Async Serial,c (0x63)
3.462406620000000,Async Serial,e (0x65)
3.462926310000000,Async Serial,s (0x73)
3.463446000000000,Async Serial,. (0x2E)
3.463965680000000,Async Serial,c (0x63)
3.464485370000000,Async Serial,s (0x73)
3.465005050000000,Async Serial,v (0x76)
3.465524740000000,Async Serial,\r (0x0D)
3.466044430000000,Async Serial,\n (0x0A)
3.466564110000000,Async Serial,- (0x2D)
3.467083800000000,Async Serial,r (0x72)
3.467603480000000,Async Serial,- (0x2D)
3.468123170000000,Async Serial,- (0x2D)
3.468642860000000,Async Serial,r (0x72)
3.469162540000000,Async Serial,- (0x2D)
3.469682230000000,Async Serial,- (0x2D)
3.470201910000000,Async Serial,r (0x72)
3.470721600000000,Async Serial,- (0x2D)
3.471241290000000,Async Serial,- (0x2D)
3.471760970000000,Async Serial,' ' (0x20)
3.472280660000000,Async Serial,r (0x72)
3.472800340000000,Async Serial,e (0x65)
3.473320030000000,Async Serial,m (0x6D)
3.473839720000000,Async Serial,o (0x6F)
3.474359400000000,Async Serial,t (0x74)
3.474879090000000,Async Serial,e (0x65)
3.475398780000000,Async Serial,' ' (0x20)
3.475918460000000,Async Serial,r (0x72)
3.476438150000000,Async Serial,e (0x65)
3.476957830000000,Async Serial,m (0x6D)
3.477477520000000,Async Serial,o (0x6F)
3.477997210000000,Async Serial,t (0x74)
3.478516890000000,Async Serial,e (0x65)
3.479036580000000,Async Serial,' ' (0x20)
3.479556270000000,Async Serial,' ' (0x20)
3.480075950000000,Async Serial,' ' (0x20)
3.480595640000000,Async Serial,' ' (0x20)
3.481115320000000,Async Serial,3 (0x33)
3.481635010000000,Async Serial,' ' (0x20)
3.482154700000000,Async Serial,s (0x73)
3.482674380000000,Async Serial,e (0x65)
3.483194070000000,Async Serial,p (0x70)
3.483713760000000,Async Serial,' ' (0x20)
3.484233440000000,Async Serial,1 (0x31)
3.484753130000000,Async Serial,4 (0x34)
3.485272810000000,Async Serial,' ' (0x20)
3.485792500000000,Async Serial,j (0x6A)
3.486312190000000,Async Serial,o (0x6F)
3.486831870000000,Async Serial,k (0x6B)
3.487351560000000,Async Serial,e (0x65)
3.487871240000000,Async Serial,. (0x2E)
3.488390930000000,Async Serial,t (0x74)
3.488910620000000,Async Serial,x (0x78)
3.489430300000000,Async Serial,t (0x74)
3.489949990000000,Async Serial,\r (0x0D)
3.490469670000000,Async Serial,\n (0x0A)
3.490989360000000,Async Serial,- (0x2D)
3.491509050000000,Async Serial,r (0x72)
3.492028730000000,Async Serial,w (0x77)
3.492548420000000,Async Serial,- (0x2D)
3.493068100000000,Async Serial,- (0x2D)
3.493587790000000,Async Serial,- (0x2D)
3.494107480000000,Async Serial,- (0x2D)
3.494627160000000,Async Serial,- (0x2D)
3.495146850000000,Async Serial,- (0x2D)
3.495666540000000,Async Serial,- (0x2D)
3.496186220000000,Async Serial,' ' (0x20)
3.496705910000000,Async Serial,r (0x72)
3.497225590000000,Async Serial,o (0x6F)
3.497745280000000,Async Serial,o (0x6F)
3.498264970000000,Async Serial,t (0x74)
3.498784650000000,Async Serial,' ' (0x20)
3.499304340000000,Async Serial,' ' (0x20)
3.499824030000000,Async Serial,' ' (0x20)
3.500343710000000,Async Serial,r (0x72)
3.500863400000000,Async Serial,o (0x6F)
3.501383080000000,Async Serial,o (0x6F)
3.501902770000000,Async Serial,t (0x74)
3.502422460000000,Async Serial,' ' (0x20)
3.502942140000000,Async Serial,' ' (0x20)
3.503461830000000,Async Serial,' ' (0x20)
3.503981520000000,Async Serial,' ' (0x20)
3.504501200000000,Async Serial,' ' (0x20)
3.505020890000000,Async Serial,3 (0x33)
3.505540570000000,Async Serial,7 (0x37)
3.506060260000000,Async Serial,' ' (0x20)
3.506579950000000,Async Serial,j (0x6A)
3.507099630000000,Async Serial,a (0x61)
3.507619320000000,Async Serial,n (0x6E)
3.508139000000000,Async Serial,' ' (0x20)
3.508658690000000,Async Serial,' ' (0x20)
3.509178380000000,Async Serial,5 (0x35)
3.509698060000000,Async Serial,' ' (0x20)
3.510217750000000,Async Serial,p (0x70)
3.510737440000000,Async Serial,a (0x61)
3.511257120000000,Async Serial,s (0x73)
3.511776810000000,Async Serial,s (0x73)
3.512296490000000,Async Serial,w (0x77)
3.512816180000000,Async Serial,d (0x64)
3.513335870000000,Async Serial,\r (0x0D)
3.513855550000000,Async Serial,\n (0x0A)
3.514375240000000,Async Serial,- (0x2D)
3.514894920000000,Async Serial,r (0x72)
3.515414610000000,Async Serial,w (0x77)
3.515934300000000,Async Serial,- (0x2D)
3.516453980000000,Async Serial,- (0x2D)
3.516973670000000,Async Serial,- (0x2D)
3.517493350000000,Async Serial,- (0x2D)
3.518013040000000,Async Serial,- (0x2D)
3.518532730000000,Async Serial,- (0x2D)
3.519052410000000,Async Serial,- (0x2D)
3.519572100000000,Async Serial,' ' (0x20)
3.520091780000000,Async Serial,r (0x72)
3.520611470000000,Async Serial,o (0x6F)
3.521131160000000,Async Serial,o (0x6F)
3.521650840000000,Async Serial,t (0x74)
3.522170530000000,Async Serial,' ' (0x20)
3.522690220000000,Async Serial,' ' (0x20)
3.523209900000000,Async Serial,' ' (0x20)
3.523729590000000,Async Serial,r (0x72)
3.524249270000000,Async Serial,o (0x6F)
3.524768960000000,Async Serial,o (0x6F)
3.525288650000000,Async Serial,t (0x74)
3.525808330000000,Async Serial,' ' (0x20)
3.526328020000000,Async Serial,' ' (0x20)
3.526847710000000,Async Serial,' ' (0x20)
3.527367390000000,Async Serial,' ' (0x20)
3.527887080000000,Async Serial,' ' (0x20)
3.528406760000000,Async Serial,' ' (0x20)
3.528926450000000,Async Serial,8 (0x38)
3.529446140000000,Async Serial,' ' (0x20)
3.529965820000000,Async Serial,j (0x6A)
3.530485510000000,Async Serial,a (0x61)
3.531005200000000,Async Serial,n (0x6E)
3.531524880000000,Async Serial,' ' (0x20)
3.532044570000000,Async Serial,' ' (0x20)
3.532564250000000,Async Serial,1 (0x31)
3.533083940000000,Async Serial,' ' (0x20)
3.533603630000000,Async Serial,p (0x70)
3.534123310000000,Async Serial,e (0x65)
3.534643000000000,Async Serial,p (0x70)
3.535162680000000,Async Serial,p (0x70)
3.535682370000000,Async Serial,e (0x65)
3.536202060000000,Async Serial,r (0x72)
3.536721740000000,Async Serial,\r (0x0D)
3.537241430000000,Async Serial,\n (0x0A)
3.537761110000000,Async Serial,\r (0x0D)
3.538280800000000,Async Serial,\n (0x0A)
3.538800490000000,Async Serial,' ' (0x20)
3.539320170000000,Async Serial,R (0x52)
3.539839860000000,Async Serial,e (0x65)
3.540359540000000,Async Serial,q (0x71)
3.540879230000000,Async Serial,u (0x75)
3.541398920000000,Async Serial,e (0x65)
3.541918600000000,Async Serial,s (0x73)
3.542438290000000,Async Serial,t (0x74)
3.542957980000000,Async Serial,? (0x3F)
3.543477660000000,Async Serial,\r (0x0D)
3.543997350000000,Async Serial,\n (0x0A)
3.544517030000000,Async Serial,\r (0x0D)
3.545036720000000,Async Serial,\n (0x0A)
3.545556410000000,Async Serial,> (0x3E)
3.546076090000000,Async Serial,> (0x3E)
3.546595780000000,Async Serial,' ' (0x20)
1 Time [s] Analyzer Name Decoded Protocol Result
2 3.352752850000000 Async Serial \r (0x0D)
3 3.353272540000000 Async Serial \n (0x0A)
4 3.353792220000000 Async Serial \r (0x0D)
5 3.354311910000000 Async Serial \n (0x0A)
6 3.354831600000000 Async Serial R (0x52)
7 3.355351280000000 Async Serial H (0x48)
8 3.355870970000000 Async Serial M (0x4D)
9 3.356390650000000 Async Serial e (0x65)
10 3.356910340000000 Async Serial O (0x4F)
11 3.357430030000000 Async Serial S (0x53)
12 3.357949710000000 Async Serial ' ' (0x20)
13 3.358469400000000 Async Serial f (0x66)
14 3.358989080000000 Async Serial i (0x69)
15 3.359508770000000 Async Serial l (0x6C)
16 3.360028460000000 Async Serial e (0x65)
17 3.360548140000000 Async Serial ' ' (0x20)
18 3.361067830000000 Async Serial A (0x41)
19 3.361587510000000 Async Serial P (0x50)
20 3.362107200000000 Async Serial I (0x49)
21 3.362626890000000 Async Serial \r (0x0D)
22 3.363146570000000 Async Serial \n (0x0A)
23 3.363666260000000 Async Serial F (0x46)
24 3.364185940000000 Async Serial i (0x69)
25 3.364705630000000 Async Serial l (0x6C)
26 3.365225320000000 Async Serial e (0x65)
27 3.365745000000000 Async Serial s (0x73)
28 3.366264690000000 Async Serial ' ' (0x20)
29 3.366784370000000 Async Serial i (0x69)
30 3.367304060000000 Async Serial n (0x6E)
31 3.367823750000000 Async Serial ' ' (0x20)
32 3.368343430000000 Async Serial s (0x73)
33 3.368863120000000 Async Serial y (0x79)
34 3.369382800000000 Async Serial s (0x73)
35 3.369902490000000 Async Serial t (0x74)
36 3.370422180000000 Async Serial e (0x65)
37 3.370941860000000 Async Serial m (0x6D)
38 3.371461550000000 Async Serial : (0x3A)
39 3.371981240000000 Async Serial \r (0x0D)
40 3.372500920000000 Async Serial \n (0x0A)
41 3.373020610000000 Async Serial \r (0x0D)
42 3.373540290000000 Async Serial \n (0x0A)
43 3.374059980000000 Async Serial d (0x64)
44 3.374579670000000 Async Serial r (0x72)
45 3.375099350000000 Async Serial w (0x77)
46 3.375619040000000 Async Serial x (0x78)
47 3.376138720000000 Async Serial r (0x72)
48 3.376658410000000 Async Serial w (0x77)
49 3.377178100000000 Async Serial x (0x78)
50 3.377697780000000 Async Serial r (0x72)
51 3.378217470000000 Async Serial - (0x2D)
52 3.378737160000000 Async Serial x (0x78)
53 3.379256840000000 Async Serial ' ' (0x20)
54 3.379776530000000 Async Serial r (0x72)
55 3.380296210000000 Async Serial e (0x65)
56 3.380815900000000 Async Serial m (0x6D)
57 3.381335580000000 Async Serial o (0x6F)
58 3.381855270000000 Async Serial t (0x74)
59 3.382374960000000 Async Serial e (0x65)
60 3.382894640000000 Async Serial ' ' (0x20)
61 3.383414330000000 Async Serial r (0x72)
62 3.383934020000000 Async Serial e (0x65)
63 3.384453700000000 Async Serial m (0x6D)
64 3.384973390000000 Async Serial o (0x6F)
65 3.385493070000000 Async Serial t (0x74)
66 3.386012760000000 Async Serial e (0x65)
67 3.386532450000000 Async Serial ' ' (0x20)
68 3.387052130000000 Async Serial 4 (0x34)
69 3.387571820000000 Async Serial 0 (0x30)
70 3.388091510000000 Async Serial 9 (0x39)
71 3.388611190000000 Async Serial 6 (0x36)
72 3.389130880000000 Async Serial ' ' (0x20)
73 3.389650560000000 Async Serial s (0x73)
74 3.390170250000000 Async Serial e (0x65)
75 3.390689940000000 Async Serial p (0x70)
76 3.391209620000000 Async Serial ' ' (0x20)
77 3.391729310000000 Async Serial ' ' (0x20)
78 3.392248990000000 Async Serial 1 (0x31)
79 3.392768680000000 Async Serial ' ' (0x20)
80 3.393288370000000 Async Serial . (0x2E)
81 3.393808050000000 Async Serial \r (0x0D)
82 3.394327740000000 Async Serial \n (0x0A)
83 3.394847420000000 Async Serial d (0x64)
84 3.395367110000000 Async Serial r (0x72)
85 3.395886800000000 Async Serial w (0x77)
86 3.396406480000000 Async Serial x (0x78)
87 3.396926170000000 Async Serial r (0x72)
88 3.397445850000000 Async Serial w (0x77)
89 3.397965540000000 Async Serial x (0x78)
90 3.398485230000000 Async Serial r (0x72)
91 3.399004910000000 Async Serial - (0x2D)
92 3.399524600000000 Async Serial x (0x78)
93 3.400044290000000 Async Serial ' ' (0x20)
94 3.400563970000000 Async Serial r (0x72)
95 3.401083660000000 Async Serial e (0x65)
96 3.401603340000000 Async Serial m (0x6D)
97 3.402123030000000 Async Serial o (0x6F)
98 3.402642720000000 Async Serial t (0x74)
99 3.403162400000000 Async Serial e (0x65)
100 3.403682090000000 Async Serial ' ' (0x20)
101 3.404201780000000 Async Serial r (0x72)
102 3.404721460000000 Async Serial e (0x65)
103 3.405241150000000 Async Serial m (0x6D)
104 3.405760830000000 Async Serial o (0x6F)
105 3.406280520000000 Async Serial t (0x74)
106 3.406800210000000 Async Serial e (0x65)
107 3.407319890000000 Async Serial ' ' (0x20)
108 3.407839580000000 Async Serial 4 (0x34)
109 3.408359260000000 Async Serial 0 (0x30)
110 3.408878950000000 Async Serial 9 (0x39)
111 3.409398640000000 Async Serial 6 (0x36)
112 3.409918320000000 Async Serial ' ' (0x20)
113 3.410438010000000 Async Serial s (0x73)
114 3.410957700000000 Async Serial e (0x65)
115 3.411477380000000 Async Serial p (0x70)
116 3.411997070000000 Async Serial ' ' (0x20)
117 3.412516750000000 Async Serial ' ' (0x20)
118 3.413036440000000 Async Serial 1 (0x31)
119 3.413556130000000 Async Serial ' ' (0x20)
120 3.414075810000000 Async Serial . (0x2E)
121 3.414595500000000 Async Serial . (0x2E)
122 3.415115180000000 Async Serial \r (0x0D)
123 3.415634870000000 Async Serial \n (0x0A)
124 3.416154560000000 Async Serial - (0x2D)
125 3.416674240000000 Async Serial r (0x72)
126 3.417193930000000 Async Serial - (0x2D)
127 3.417713610000000 Async Serial - (0x2D)
128 3.418233300000000 Async Serial r (0x72)
129 3.418752990000000 Async Serial - (0x2D)
130 3.419272670000000 Async Serial - (0x2D)
131 3.419792360000000 Async Serial r (0x72)
132 3.420312040000000 Async Serial - (0x2D)
133 3.420831730000000 Async Serial - (0x2D)
134 3.421351420000000 Async Serial ' ' (0x20)
135 3.421871100000000 Async Serial r (0x72)
136 3.422390790000000 Async Serial e (0x65)
137 3.422910480000000 Async Serial m (0x6D)
138 3.423430160000000 Async Serial o (0x6F)
139 3.423949850000000 Async Serial t (0x74)
140 3.424469530000000 Async Serial e (0x65)
141 3.424989220000000 Async Serial ' ' (0x20)
142 3.425508910000000 Async Serial r (0x72)
143 3.426028590000000 Async Serial e (0x65)
144 3.426548280000000 Async Serial m (0x6D)
145 3.427067970000000 Async Serial o (0x6F)
146 3.427587650000000 Async Serial t (0x74)
147 3.428107340000000 Async Serial e (0x65)
148 3.428627020000000 Async Serial ' ' (0x20)
149 3.429146710000000 Async Serial ' ' (0x20)
150 3.429666400000000 Async Serial ' ' (0x20)
151 3.430186080000000 Async Serial 8 (0x38)
152 3.430705770000000 Async Serial 7 (0x37)
153 3.431225460000000 Async Serial ' ' (0x20)
154 3.431745140000000 Async Serial s (0x73)
155 3.432264830000000 Async Serial e (0x65)
156 3.432784510000000 Async Serial p (0x70)
157 3.433304200000000 Async Serial ' ' (0x20)
158 3.433823890000000 Async Serial 1 (0x31)
159 3.434343570000000 Async Serial 4 (0x34)
160 3.434863260000000 Async Serial ' ' (0x20)
161 3.435382940000000 Async Serial c (0x63)
162 3.435902630000000 Async Serial a (0x61)
163 3.436422320000000 Async Serial t (0x74)
164 3.436942000000000 Async Serial . (0x2E)
165 3.437461690000000 Async Serial t (0x74)
166 3.437981370000000 Async Serial x (0x78)
167 3.438501060000000 Async Serial t (0x74)
168 3.439020750000000 Async Serial \r (0x0D)
169 3.439540430000000 Async Serial \n (0x0A)
170 3.440060120000000 Async Serial - (0x2D)
171 3.440579800000000 Async Serial r (0x72)
172 3.441099490000000 Async Serial - (0x2D)
173 3.441619180000000 Async Serial - (0x2D)
174 3.442138860000000 Async Serial r (0x72)
175 3.442658550000000 Async Serial - (0x2D)
176 3.443178240000000 Async Serial - (0x2D)
177 3.443697920000000 Async Serial r (0x72)
178 3.444217610000000 Async Serial - (0x2D)
179 3.444737290000000 Async Serial - (0x2D)
180 3.445256980000000 Async Serial ' ' (0x20)
181 3.445776670000000 Async Serial r (0x72)
182 3.446296350000000 Async Serial e (0x65)
183 3.446816040000000 Async Serial m (0x6D)
184 3.447335720000000 Async Serial o (0x6F)
185 3.447855410000000 Async Serial t (0x74)
186 3.448375100000000 Async Serial e (0x65)
187 3.448894780000000 Async Serial ' ' (0x20)
188 3.449414470000000 Async Serial r (0x72)
189 3.449934160000000 Async Serial e (0x65)
190 3.450453840000000 Async Serial m (0x6D)
191 3.450973530000000 Async Serial o (0x6F)
192 3.451493210000000 Async Serial t (0x74)
193 3.452012900000000 Async Serial e (0x65)
194 3.452532590000000 Async Serial ' ' (0x20)
195 3.453052270000000 Async Serial ' ' (0x20)
196 3.453571960000000 Async Serial ' ' (0x20)
197 3.454091640000000 Async Serial 4 (0x34)
198 3.454611330000000 Async Serial 7 (0x37)
199 3.455131020000000 Async Serial ' ' (0x20)
200 3.455650700000000 Async Serial s (0x73)
201 3.456170390000000 Async Serial e (0x65)
202 3.456690080000000 Async Serial p (0x70)
203 3.457209760000000 Async Serial ' ' (0x20)
204 3.457729450000000 Async Serial 1 (0x31)
205 3.458249130000000 Async Serial 6 (0x36)
206 3.458768820000000 Async Serial ' ' (0x20)
207 3.459288510000000 Async Serial f (0x66)
208 3.459808190000000 Async Serial i (0x69)
209 3.460327880000000 Async Serial n (0x6E)
210 3.460847560000000 Async Serial a (0x61)
211 3.461367250000000 Async Serial n (0x6E)
212 3.461886940000000 Async Serial c (0x63)
213 3.462406620000000 Async Serial e (0x65)
214 3.462926310000000 Async Serial s (0x73)
215 3.463446000000000 Async Serial . (0x2E)
216 3.463965680000000 Async Serial c (0x63)
217 3.464485370000000 Async Serial s (0x73)
218 3.465005050000000 Async Serial v (0x76)
219 3.465524740000000 Async Serial \r (0x0D)
220 3.466044430000000 Async Serial \n (0x0A)
221 3.466564110000000 Async Serial - (0x2D)
222 3.467083800000000 Async Serial r (0x72)
223 3.467603480000000 Async Serial - (0x2D)
224 3.468123170000000 Async Serial - (0x2D)
225 3.468642860000000 Async Serial r (0x72)
226 3.469162540000000 Async Serial - (0x2D)
227 3.469682230000000 Async Serial - (0x2D)
228 3.470201910000000 Async Serial r (0x72)
229 3.470721600000000 Async Serial - (0x2D)
230 3.471241290000000 Async Serial - (0x2D)
231 3.471760970000000 Async Serial ' ' (0x20)
232 3.472280660000000 Async Serial r (0x72)
233 3.472800340000000 Async Serial e (0x65)
234 3.473320030000000 Async Serial m (0x6D)
235 3.473839720000000 Async Serial o (0x6F)
236 3.474359400000000 Async Serial t (0x74)
237 3.474879090000000 Async Serial e (0x65)
238 3.475398780000000 Async Serial ' ' (0x20)
239 3.475918460000000 Async Serial r (0x72)
240 3.476438150000000 Async Serial e (0x65)
241 3.476957830000000 Async Serial m (0x6D)
242 3.477477520000000 Async Serial o (0x6F)
243 3.477997210000000 Async Serial t (0x74)
244 3.478516890000000 Async Serial e (0x65)
245 3.479036580000000 Async Serial ' ' (0x20)
246 3.479556270000000 Async Serial ' ' (0x20)
247 3.480075950000000 Async Serial ' ' (0x20)
248 3.480595640000000 Async Serial ' ' (0x20)
249 3.481115320000000 Async Serial 3 (0x33)
250 3.481635010000000 Async Serial ' ' (0x20)
251 3.482154700000000 Async Serial s (0x73)
252 3.482674380000000 Async Serial e (0x65)
253 3.483194070000000 Async Serial p (0x70)
254 3.483713760000000 Async Serial ' ' (0x20)
255 3.484233440000000 Async Serial 1 (0x31)
256 3.484753130000000 Async Serial 4 (0x34)
257 3.485272810000000 Async Serial ' ' (0x20)
258 3.485792500000000 Async Serial j (0x6A)
259 3.486312190000000 Async Serial o (0x6F)
260 3.486831870000000 Async Serial k (0x6B)
261 3.487351560000000 Async Serial e (0x65)
262 3.487871240000000 Async Serial . (0x2E)
263 3.488390930000000 Async Serial t (0x74)
264 3.488910620000000 Async Serial x (0x78)
265 3.489430300000000 Async Serial t (0x74)
266 3.489949990000000 Async Serial \r (0x0D)
267 3.490469670000000 Async Serial \n (0x0A)
268 3.490989360000000 Async Serial - (0x2D)
269 3.491509050000000 Async Serial r (0x72)
270 3.492028730000000 Async Serial w (0x77)
271 3.492548420000000 Async Serial - (0x2D)
272 3.493068100000000 Async Serial - (0x2D)
273 3.493587790000000 Async Serial - (0x2D)
274 3.494107480000000 Async Serial - (0x2D)
275 3.494627160000000 Async Serial - (0x2D)
276 3.495146850000000 Async Serial - (0x2D)
277 3.495666540000000 Async Serial - (0x2D)
278 3.496186220000000 Async Serial ' ' (0x20)
279 3.496705910000000 Async Serial r (0x72)
280 3.497225590000000 Async Serial o (0x6F)
281 3.497745280000000 Async Serial o (0x6F)
282 3.498264970000000 Async Serial t (0x74)
283 3.498784650000000 Async Serial ' ' (0x20)
284 3.499304340000000 Async Serial ' ' (0x20)
285 3.499824030000000 Async Serial ' ' (0x20)
286 3.500343710000000 Async Serial r (0x72)
287 3.500863400000000 Async Serial o (0x6F)
288 3.501383080000000 Async Serial o (0x6F)
289 3.501902770000000 Async Serial t (0x74)
290 3.502422460000000 Async Serial ' ' (0x20)
291 3.502942140000000 Async Serial ' ' (0x20)
292 3.503461830000000 Async Serial ' ' (0x20)
293 3.503981520000000 Async Serial ' ' (0x20)
294 3.504501200000000 Async Serial ' ' (0x20)
295 3.505020890000000 Async Serial 3 (0x33)
296 3.505540570000000 Async Serial 7 (0x37)
297 3.506060260000000 Async Serial ' ' (0x20)
298 3.506579950000000 Async Serial j (0x6A)
299 3.507099630000000 Async Serial a (0x61)
300 3.507619320000000 Async Serial n (0x6E)
301 3.508139000000000 Async Serial ' ' (0x20)
302 3.508658690000000 Async Serial ' ' (0x20)
303 3.509178380000000 Async Serial 5 (0x35)
304 3.509698060000000 Async Serial ' ' (0x20)
305 3.510217750000000 Async Serial p (0x70)
306 3.510737440000000 Async Serial a (0x61)
307 3.511257120000000 Async Serial s (0x73)
308 3.511776810000000 Async Serial s (0x73)
309 3.512296490000000 Async Serial w (0x77)
310 3.512816180000000 Async Serial d (0x64)
311 3.513335870000000 Async Serial \r (0x0D)
312 3.513855550000000 Async Serial \n (0x0A)
313 3.514375240000000 Async Serial - (0x2D)
314 3.514894920000000 Async Serial r (0x72)
315 3.515414610000000 Async Serial w (0x77)
316 3.515934300000000 Async Serial - (0x2D)
317 3.516453980000000 Async Serial - (0x2D)
318 3.516973670000000 Async Serial - (0x2D)
319 3.517493350000000 Async Serial - (0x2D)
320 3.518013040000000 Async Serial - (0x2D)
321 3.518532730000000 Async Serial - (0x2D)
322 3.519052410000000 Async Serial - (0x2D)
323 3.519572100000000 Async Serial ' ' (0x20)
324 3.520091780000000 Async Serial r (0x72)
325 3.520611470000000 Async Serial o (0x6F)
326 3.521131160000000 Async Serial o (0x6F)
327 3.521650840000000 Async Serial t (0x74)
328 3.522170530000000 Async Serial ' ' (0x20)
329 3.522690220000000 Async Serial ' ' (0x20)
330 3.523209900000000 Async Serial ' ' (0x20)
331 3.523729590000000 Async Serial r (0x72)
332 3.524249270000000 Async Serial o (0x6F)
333 3.524768960000000 Async Serial o (0x6F)
334 3.525288650000000 Async Serial t (0x74)
335 3.525808330000000 Async Serial ' ' (0x20)
336 3.526328020000000 Async Serial ' ' (0x20)
337 3.526847710000000 Async Serial ' ' (0x20)
338 3.527367390000000 Async Serial ' ' (0x20)
339 3.527887080000000 Async Serial ' ' (0x20)
340 3.528406760000000 Async Serial ' ' (0x20)
341 3.528926450000000 Async Serial 8 (0x38)
342 3.529446140000000 Async Serial ' ' (0x20)
343 3.529965820000000 Async Serial j (0x6A)
344 3.530485510000000 Async Serial a (0x61)
345 3.531005200000000 Async Serial n (0x6E)
346 3.531524880000000 Async Serial ' ' (0x20)
347 3.532044570000000 Async Serial ' ' (0x20)
348 3.532564250000000 Async Serial 1 (0x31)
349 3.533083940000000 Async Serial ' ' (0x20)
350 3.533603630000000 Async Serial p (0x70)
351 3.534123310000000 Async Serial e (0x65)
352 3.534643000000000 Async Serial p (0x70)
353 3.535162680000000 Async Serial p (0x70)
354 3.535682370000000 Async Serial e (0x65)
355 3.536202060000000 Async Serial r (0x72)
356 3.536721740000000 Async Serial \r (0x0D)
357 3.537241430000000 Async Serial \n (0x0A)
358 3.537761110000000 Async Serial \r (0x0D)
359 3.538280800000000 Async Serial \n (0x0A)
360 3.538800490000000 Async Serial ' ' (0x20)
361 3.539320170000000 Async Serial R (0x52)
362 3.539839860000000 Async Serial e (0x65)
363 3.540359540000000 Async Serial q (0x71)
364 3.540879230000000 Async Serial u (0x75)
365 3.541398920000000 Async Serial e (0x65)
366 3.541918600000000 Async Serial s (0x73)
367 3.542438290000000 Async Serial t (0x74)
368 3.542957980000000 Async Serial ? (0x3F)
369 3.543477660000000 Async Serial \r (0x0D)
370 3.543997350000000 Async Serial \n (0x0A)
371 3.544517030000000 Async Serial \r (0x0D)
372 3.545036720000000 Async Serial \n (0x0A)
373 3.545556410000000 Async Serial > (0x3E)
374 3.546076090000000 Async Serial > (0x3E)
375 3.546595780000000 Async Serial ' ' (0x20)

View File

@ -0,0 +1,11 @@
Welcome to our casino, Riscure Royale! Please enjoy your stay by
playing a game, or drink something at our bar. Reach 1000 credits and
you will be rewarded with a special prize.
We have seen loads of cheaters lately, so we have extra guards walking
around. Do not feel threatened by them, they will only kick out the
people that cheat. Of course, once you earn a lot of money they will
start investigating the matter. Better spend some money at our bar if
this happens.
PS. We all know casinos are scams.

View File

@ -0,0 +1,10 @@
We captured a crazy guy aiming a LED at planes passing by. We believe
he is a spy from the Republic of Wadiya. Your task is to reverse how
the device works and extract the keys without analyzing power or
electromagnetic traces.
Good luck random internet player!
Note: This challenge can be solved without fancy hardware. You can
check if you got the right flag (key) by encrypting the input and
comparing it against the output.

View File

@ -0,0 +1,64 @@
Elias Öberson @DrAndroid1337 - Nov 8
Sorry, I have been offline for 3 days. My provider cancelled my
internet subscription by error.
Elias Öberson @DrAndroid1337 - Nov 8
I finally hacked the "V2" device. It is not that hard once you know
when to inject the glitch. Unfortunately I still don't know how to use
it
Elias Öberson @DrAndroid1337 - Nov 8
There is no interface, no menus, no options. Only the "Chip
locked. Please write your password:" and then, nothing.
Elias Öberson @DrAndroid1337 - Nov 8
Please, retweet this photo to see if somebody knows what this device
is.
Elias Öberson @DrAndroid1337 - Nov 9
NO! AGAIN!
Elias Öberson @DrAndroid1337 - Nov 9
V3!!! WTF!!!
Elias Öberson @DrAndroid1337 - Nov 9
THIS CANNOT BE A COINCIDENCE! I AM FREAKING OUT!
Elias Öberson @DrAndroid1337 - Nov 9
@Leneko2015, is this one of your jokes? Is this a revenge for the day
I triggered your home alarm using the SDR?
Elias Öberson @DrAndroid1337 - Nov 9
@Leneko2015, I am not playing this game anymore.
Elias Öberson @DrAndroid1337 - Nov 11
This is weird. I think somebody is following me.
Elias Öberson @DrAndroid1337 - Nov 11
OK. He was not following me. Maybe I am paranoid lately.
Elias Öberson @DrAndroid1337 - Nov 12
Grand Cheef McAuto released for the Xstation! I need to play it right
now
Elias Öberson @DrAndroid1337 - Nov 15
The same guy. Following me!? Or am I just paranoid again?
Elias Öberson @DrAndroid1337 - Nov 15
HE IS REALLY FOLLOWING ME!!!
Elias Öberson @DrAndroid1337 - Nov 15
I went to the police. They don't believe me. They said I am paranoid
Elias Öberson @DrAndroid1337 - Nov 15
Is this all related? The USB devices, the strange phone calls, the
guy. Two days ago I thought there was somebody behind my door.
Elias Öberson @DrAndroid1337 - Nov 16
I am trying to hack the "V3" device. A password again, but I cannot
bypass it like last time.
Elias Öberson @DrAndroid1337 - Nov 18
I am not feeling safe anymore. Too many things are happening. I am
going out the city for few days. I take the USB device with me

View File

@ -0,0 +1,25 @@
Elias Öberson @DrAndroid1337 - Nov 1
Walking around the financial district, I stumbled upon this strange
device. Does anybody know what it is?
Elias Öberson @DrAndroid1337 - Nov 1
It does not have any recognisable logos or marks, only the letters
"V1" written on one side and a USB connector on the other. Here is a
photo.
Elias Öberson @DrAndroid1337 - Nov 1
It probably is some kind of memory, but it has an unusual design. I
will check it when I arrive home.
Elias Öberson @DrAndroid1337 - Nov 1
I finally arrived home. I connected the USB device to my computer, but
it looks that it is permanently locked.
Elias Öberson @DrAndroid1337 - Nov 1
Now I am curious about the device and its content. Would I be able to
unlock it using FI?

View File

@ -0,0 +1,35 @@
Elias Öberson @DrAndroid1337 - Nov 2
I hacked this device! I unlocked it!
Elias Öberson @DrAndroid1337 - Nov 2
It was easy to break this strange device, but unfortunately I don't
understand how it works. It doesn't seem to do anything. Any
suggestion?
Elias Öberson @DrAndroid1337 - Nov 3
Again! I found a similar device in the street! Who is the fool that
keeps losing these "pendrives"!?
Elias Öberson @DrAndroid1337 - Nov 3
It looks the same but now it has a "V2" mark. There is nothing good on
TV tonight so I will take a look at this.
Elias Öberson @DrAndroid1337 - Nov 3
It's not locked! That's good! Maybe I can find what it
does. Unfortunately it asks for a password but I think I can bypass it
using FI again.
Elias Öberson @DrAndroid1337 - Nov 4
The "V1" was very easy to break but this one... A couple of hours
already and still nothing.
Elias Öberson @DrAndroid1337 - Nov 4
OK! It's 3AM. I think I will continue tomorrow.
Elias Öberson @DrAndroid1337 - Nov 4
I cannot sleep. Somebody keeps calling my landline. They do not say
anything but I can hear them breathing.
Elias Öberson @DrAndroid1337 - Nov 4
I disconnected the phone but the moron has my mobile! I am sure it is
@Leneko2015, bored at home.

Binary file not shown.

View File

@ -0,0 +1,6 @@
We really need access to this lab protected with an Arduino-based
access control system. Our operatives obtained a flash dump from a
non-personalized engineering sample, but we are having trouble reverse
engineering it.
Can you help us get the password to get through?

View File

@ -0,0 +1,8 @@
We have received a portable asymmetric key storage for evaluation
purposes. This portable device was manufactured by Ebian Corp to
facilitate secure communications with customers. It generates and
stores adminstrators' public keys. Customers can use this repository
to find the public key of the admin they want to contact, and
administrators can use this repository to update their key
information. If this fancy keychain passes the test we are going to
give them away like candy, secure candy.

View File

@ -0,0 +1,10 @@
We have recently been informed that a group of hackers exploited a
vulnerability in a PC within another very secure network. Our
operative says the hacker in charge took a snapshot of the password,
which they stored in their secret hidden-away database.
Today we found a photo manager service running on the internet. This
service can be linked to the hacker who retrieved the passwords. From
the size of the photo manager we can see they stored lots of pictures,
so we are hoping they stored the password on their photo manager
too. Can you breach their photo manager and take a quick look?

View File

@ -0,0 +1,6 @@
This is an easy SCA challenge using a cipher implementation without
any SCA or DFA countermeasures. Find the key used to encrypt and
decrypt messages. Please, consider both SCA and DFA attacks.
To encrypt a message, send the letter 'e' followed of 16 bytes. To
decrypt a message, send the letter 'd' followed of 16 bytes.

View File

@ -0,0 +1,3 @@
We added even more countermeasures.
Good luck!

View File

@ -0,0 +1,12 @@
We managed to capture a group of spies at our premises. Our
specialists in enhanced interrogation techniques worked through the
entire night but did not manage to retrieve any information.
Luckily, we intercepted the spy as they were trying to chew and
swallow the Arduino Nano device that they were carrying in their
pocket. The device is protected with a password and the Pure Software
Exploitation Team applied all the tricks they have but did not find
any way to guess the secret password.
Can you find the correct password and get the secret data stored on
the device?

View File

@ -0,0 +1,3 @@
We added a simple countermeasure to the previous challenge.
Will you be able to break it?

View File

@ -0,0 +1,6 @@
Who doesn't like a classic game of whac-the-mole? This time the moles
infiltrated deep into the backyard of a poor farmer's family. The
moles are ruining the crops, which the farmer desperately needs to
provide for his wife and 2 children. Any traveler able to help him by
extinguishing the darn things will be greatly rewarded. Are you up for
the task?

View File

@ -0,0 +1,24 @@
# sca 1 - piece of scake
# simple aes sca challenge without any delays
# define DRANDOM_DELAY to enable random delays
# define DTRIGGER=1 to enable a trigger right before entering aes_enc()
simplesca: CHNAME=simplesca
simplesca: OBJECTS=$(addprefix bin/,$(SERIAL) $(AESPROTECTED) $(SIMPLESCA)) aes/gf256mul.S
simplesca: ADDFLAGS=-Iserial -Iaesprotected -DDELAYSIZE=0x0 -DTRIGGER=1 -DENABLE_RANDOMDELAY=0 -DENABLE_DUMMYROUNDS=0 -DENABLE_ANTIDFA=0 -DAES_ENCRYPTION=0
simplesca: serial aesprotected1 $(addprefix simplesca/,$(SIMPLESCA))
simplesca: simplesca.enc.hex
# sca 2 - still not scary
mediumsca: CHNAME=mediumsca
mediumsca: OBJECTS=$(addprefix bin/,$(SERIAL) $(AESPROTECTED) $(MEDIUMSCA)) aes/gf256mul.S
mediumsca: ADDFLAGS=-Iserial -Iaesprotected -DDELAYSIZE=0x0 -DTRIGGER=0 -DENABLE_RANDOMDELAY=1
mediumsca: serial aesprotected2 $(addprefix mediumsca/,$(MEDIUMSCA))
mediumsca: mediumsca.enc.hex
# sca 3 - wow that escalated quickly
hardsca: CHNAME=hardsca
hardsca: OBJECTS=$(addprefix bin/,$(SERIAL) $(AESPROTECTED) $(HARDSCA)) aes/gf256mul.S
hardsca: ADDFLAGS=-Iserial -Iaesprotected -DDELAYSIZE=0x0 -DTRIGGER=0 -DENABLE_RANDOMDELAY=1 -DENABLE_DUMMYROUNDS=1 -DENABLE_ANTIDFA=1 -DAES_ENCRYPTION=1
hardsca: serial aesprotected3 $(addprefix hardsca/,$(HARDSCA))
hardsca: hardsca.enc.hex

View File

@ -0,0 +1,13 @@
# Rhme-2016
The source code is not compilable at the moment, it will be possible to
compile it eventually once all the dependencies are in place. It is
posted here to help you understand the vulnerabilities.
## Compilation
### Tools
### Instructions

View File

@ -0,0 +1,486 @@
/* aes.c */
/*
* This code is/was initially part of the AVR-Crypto-Lib. It is now
* stripped down such that only AES 128 encryption and decryption in
* CBC mode is supported.
*
* Copyright (C) 2016 alegen (alex@alegen.net)
* Copyright (C) 2006-2016 Daniel Otte (bg@nerilex.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "aesProtected.h"
#include <avr/pgmspace.h>
#include "gf256mul.h"
/*
* Function prototypes which are not public.
*/
static void aes_rotword(uint32_t* a);
#if AES_ENCRYPTION
static void aes_enc_round(aes_state_t data, aes_roundkey_t k);
static void aes_enc_lastround(aes_state_t data, aes_roundkey_t k);
static void aes_shiftrow(uint8_t* row_start, uint8_t shift);
#endif
static void aes_dec_firstround(aes_state_t data, aes_roundkey_t k);
static void aes_dec_round(aes_state_t data, aes_roundkey_t k);
static void aes_invshiftrow(uint8_t* row_start, uint8_t shift);
/*
* Tables with precomputed values.
*/
const uint8_t PROGMEM aes_sbox[256] = {
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26,
0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2,
0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0,
0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed,
0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f,
0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5,
0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec,
0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14,
0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c,
0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d,
0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f,
0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11,
0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f,
0xb0, 0x54, 0xbb, 0x16};
const uint8_t PROGMEM aes_invsbox[256] = {
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32,
0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,
0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49,
0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16,
0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50,
0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05,
0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02,
0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41,
0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,
0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8,
0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89,
0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b,
0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59,
0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d,
0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d,
0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63,
0x55, 0x21, 0x0c, 0x7d};
const uint8_t PROGMEM rc_tab[] = {
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c};
/*
* AES key expansion code
*/
void aes_key_expansion(aes_key_t key) {
uint8_t i;
// number of columns (32 bit words) comprising the state
// in generic AES, this is constant to 4
uint8_t nb = 4;
// number of 32 bit words comprising the cipher key
// 4, 6 or 8, but 4 in our case
uint8_t nk = 4;
// number of rounds which is either 10, 12 or 14, but 10 in our case
uint8_t nr = 10;
// union which lets us select easily between 32 bit
// words and individual bytes
union {
uint32_t v32;
uint8_t v8[4];
} tmp;
for (i = nk; i < nb * (nr + 1); i++) {
SHORTRANDOMDELAY();
tmp.v32 = ((uint32_t*)key)[i - 1];
if ( i % nk == 0) {
aes_rotword(&(tmp.v32));
tmp.v8[0] = pgm_read_byte(aes_sbox + tmp.v8[0]);
tmp.v8[1] = pgm_read_byte(aes_sbox + tmp.v8[1]);
tmp.v8[2] = pgm_read_byte(aes_sbox + tmp.v8[2]);
tmp.v8[3] = pgm_read_byte(aes_sbox + tmp.v8[3]);
tmp.v8[0] ^= pgm_read_byte(rc_tab + i / nk);
}
((uint32_t*)key)[i] = ((uint32_t*)key)[i - nk] ^ tmp.v32;
}
}
static void aes_rotword(uint32_t* a) {
uint8_t t;
t = ((uint8_t*)a)[0];
((uint8_t*)a)[0] = ((uint8_t*)a)[1];
((uint8_t*)a)[1] = ((uint8_t*)a)[2];
((uint8_t*)a)[2] = ((uint8_t*)a)[3];
((uint8_t*)a)[3] = t;
}
/*
* AES encryption code.
*/
#if AES_ENCRYPTION
void aes_ecb_encrypt_inner(aes_state_t data, aes_key_t key) {
uint8_t i;
uint8_t rounds = 10;
RANDOMDELAY();
for (i = 0; i < 16; ++i) {
data[i] ^= key[0 * AES_ROUNDKEY_SIZE + i];
SHORTRANDOMDELAY();
}
i = 1;
for (; rounds > 1; --rounds) {
RANDOMDELAY();
executeWithDummies(&aes_enc_round, data, key + i * AES_ROUNDKEY_SIZE);
++i;
}
RANDOMDELAY();
executeWithDummies(&aes_enc_lastround, data, key + i * AES_ROUNDKEY_SIZE);
RANDOMDELAY();
}
void aes_ecb_encrypt(aes_state_t data, aes_key_t key) {
#if ENABLE_ANTIDFA
uint8_t bufBck[AES_STATE_SIZE];
aes_state_t dataBck = bufBck;
memcpy(dataBck, data, AES_STATE_SIZE);
#endif
aes_ecb_encrypt_inner(data, key);
#if ENABLE_ANTIDFA
LONGDELAY();
aes_ecb_encrypt_inner(dataBck, key);
if (memcmp(data,dataBck,AES_STATE_SIZE) != 0) {
memset(data,0,AES_STATE_SIZE); //Fault detected. Clearing the output
}
#endif
}
void aes_cbc_encrypt(aes_state_t data, aes_iv_t iv, aes_key_t key) {
uint8_t i;
for (i = 0; i < AES_STATE_SIZE; i++)
data[i] = data[i] ^ iv[i];
aes_ecb_encrypt(data, key);
}
static void aes_enc_round(aes_state_t data, aes_roundkey_t k) {
uint8_t tmp[16], t;
uint8_t i;
// sub bytes
for (i = 0; i < 16; ++i) {
tmp[i] = pgm_read_byte(aes_sbox + data[i]);
}
// shift rows
SHORTRANDOMDELAY();
aes_shiftrow(tmp + 1, 1);
SHORTRANDOMDELAY();
aes_shiftrow(tmp + 2, 2);
SHORTRANDOMDELAY();
aes_shiftrow(tmp + 3, 3);
SHORTRANDOMDELAY();
// mix colums
for (i = 0; i < 4; ++i) {
t = tmp[4 * i + 0] ^ tmp[4 * i + 1] ^ tmp[4 * i + 2] ^ tmp[4 * i + 3];
SHORTRANDOMDELAY();
data[4 * i + 0] = gf256mul(2, tmp[4 * i + 0] ^ tmp[4 * i + 1], 0x1b) ^
tmp[4 * i + 0] ^ t;
SHORTRANDOMDELAY();
data[4 * i + 1] = gf256mul(2, tmp[4 * i + 1] ^ tmp[4 * i + 2], 0x1b) ^
tmp[4 * i + 1] ^ t;
SHORTRANDOMDELAY();
data[4 * i + 2] = gf256mul(2, tmp[4 * i + 2] ^ tmp[4 * i + 3], 0x1b) ^
tmp[4 * i + 2] ^ t;
SHORTRANDOMDELAY();
data[4 * i + 3] = gf256mul(2, tmp[4 * i + 3] ^ tmp[4 * i + 0], 0x1b) ^
tmp[4 * i + 3] ^ t;
SHORTRANDOMDELAY();
}
// add key
for (i = 0; i < 16; ++i) {
data[i] ^= k[i];
SHORTRANDOMDELAY();
}
}
static void aes_enc_lastround(aes_state_t data, aes_roundkey_t k) {
uint8_t i;
// sub bytes
for (i = 0; i < 16; ++i) {
data[i] = pgm_read_byte(aes_sbox + data[i]);
}
// shift rows
SHORTRANDOMDELAY();
aes_shiftrow(data + 1, 1);
SHORTRANDOMDELAY();
aes_shiftrow(data + 2, 2);
SHORTRANDOMDELAY();
aes_shiftrow(data + 3, 3);
SHORTRANDOMDELAY();
// add key
for (i = 0; i < 16; ++i) {
data[i] ^= k[i];
SHORTRANDOMDELAY();
}
}
static void aes_shiftrow(uint8_t* row_start, uint8_t shift) {
uint8_t row[4];
row[0] = row_start[ 0];
row[1] = row_start[ 4];
row[2] = row_start[ 8];
row[3] = row_start[12];
row_start[ 0] = row[ (shift + 0) & 3 ];
row_start[ 4] = row[ (shift + 1) & 3 ];
row_start[ 8] = row[ (shift + 2) & 3 ];
row_start[12] = row[ (shift + 3) & 3 ];
}
#endif // AES_ENCRYPTION
/*
* AES decryption code.
*/
void aes_ecb_decrypt_inner(aes_state_t data, aes_key_t key) {
uint8_t i;
uint8_t rounds = 10;
i = rounds;
RANDOMDELAY();
executeWithDummies(&aes_dec_firstround,data, key + i * AES_ROUNDKEY_SIZE);
for (; rounds > 1; --rounds) {
--i;
RANDOMDELAY();
executeWithDummies(&aes_dec_round,data, key + i * AES_ROUNDKEY_SIZE);
}
RANDOMDELAY();
for (i = 0; i < 16; ++i) {
SHORTRANDOMDELAY();
data[i] ^= key[0 * AES_ROUNDKEY_SIZE + i];
}
RANDOMDELAY();
}
void aes_ecb_decrypt(aes_state_t data, aes_key_t key) {
#if ENABLE_ANTIDFA
uint8_t bufBck[AES_STATE_SIZE];
aes_state_t dataBck = bufBck;
memcpy(dataBck, data, AES_STATE_SIZE);
#endif
aes_ecb_decrypt_inner(data, key);
#if ENABLE_ANTIDFA
LONGDELAY();
aes_ecb_decrypt_inner(dataBck, key);
if (memcmp(data,dataBck,AES_STATE_SIZE) != 0) {
memset(data,0,AES_STATE_SIZE); //Fault detected. Clearing the output
}
#endif
}
void aes_cbc_decrypt(aes_state_t data, aes_iv_t iv, aes_key_t key) {
uint8_t i;
aes_ecb_decrypt(data, key);
for (i = 0; i < AES_STATE_SIZE; i++)
data[i] = data[i] ^ iv[i];
}
static void aes_dec_firstround(aes_state_t data, aes_roundkey_t k) {
uint8_t i;
// add key
for (i = 0; i < 16; ++i) {
SHORTRANDOMDELAY();
data[i] ^= k[i];
}
// shift rows
SHORTRANDOMDELAY();
aes_invshiftrow(data + 1, 1);
SHORTRANDOMDELAY();
aes_invshiftrow(data + 2, 2);
SHORTRANDOMDELAY();
aes_invshiftrow(data + 3, 3);
SHORTRANDOMDELAY();
// sub bytes
for (i = 0; i < 16; ++i) {
data[i] = pgm_read_byte(aes_invsbox + data[i]);
}
}
static void aes_dec_round(aes_state_t data, aes_roundkey_t k) {
uint8_t tmp[16];
uint8_t i;
uint8_t t, u, v, w;
// add key
for (i = 0; i < 16; ++i) {
SHORTRANDOMDELAY();
tmp[i] = data[i] ^ k[i];
}
// mix colums
for (i = 0; i < 4; ++i) {
SHORTRANDOMDELAY();
t = tmp[4 * i + 3] ^ tmp[4 * i + 2];
SHORTRANDOMDELAY();
u = tmp[4 * i + 1] ^ tmp[4 * i + 0];
SHORTRANDOMDELAY();
v = t ^ u;
SHORTRANDOMDELAY();
v = gf256mul(0x09, v, 0x1b);
SHORTRANDOMDELAY();
w = v ^ gf256mul(0x04, tmp[4 * i + 2] ^ tmp[4 * i + 0], 0x1b);
SHORTRANDOMDELAY();
v = v ^ gf256mul(0x04, tmp[4 * i + 3] ^ tmp[4 * i + 1], 0x1b);
SHORTRANDOMDELAY();
data[4 * i + 3] = tmp[4 * i + 3] ^ v ^
gf256mul(0x02, tmp[4 * i + 0] ^ tmp[4 * i + 3], 0x1b);
SHORTRANDOMDELAY();
data[4 * i + 2] = tmp[4 * i + 2] ^ w ^ gf256mul(0x02, t, 0x1b);
SHORTRANDOMDELAY();
data[4 * i + 1] = tmp[4 * i + 1] ^ v ^
gf256mul(0x02, tmp[4 * i + 2] ^ tmp[4 * i + 1], 0x1b);
SHORTRANDOMDELAY();
data[4 * i + 0] = tmp[4 * i + 0] ^ w ^ gf256mul(0x02, u, 0x1b);
}
// shift rows
SHORTRANDOMDELAY();
aes_invshiftrow(data + 1, 1);
SHORTRANDOMDELAY();
aes_invshiftrow(data + 2, 2);
SHORTRANDOMDELAY();
aes_invshiftrow(data + 3, 3);
SHORTRANDOMDELAY();
// sub bytes
for (i = 0; i < 16; ++i) {
data[i] = pgm_read_byte(aes_invsbox + data[i]);
}
}
static void aes_invshiftrow(uint8_t* row_start, uint8_t shift) {
uint8_t row[4];
row[0] = row_start[ 0];
row[1] = row_start[ 4];
row[2] = row_start[ 8];
row[3] = row_start[12];
row_start[ 0] = row[ (4 - shift + 0) & 3 ];
row_start[ 4] = row[ (4 - shift + 1) & 3 ];
row_start[ 8] = row[ (4 - shift + 2) & 3 ];
row_start[12] = row[ (4 - shift + 3) & 3 ];
}
#if ENABLE_RANDOMDELAY
void random_delay(uint16_t max_value) {
volatile uint16_t n = rand() % max_value;
for (; n > 0; n--) { \
asm volatile("nop"); \
}
}
#endif
void delay(uint16_t value) {
volatile uint16_t n =value;
for (; n > 0; n--) { \
asm volatile("nop"); \
}
}
void executeWithDummies(void (*function)(uint8_t *, uint8_t *), uint8_t *data, uint8_t *key) {
#if ENABLE_DUMMYROUNDS
uint8_t randomData[16+16];
uint8_t i, j;
uint8_t numDummies = 1 + rand()%3;
uint8_t posRealOp = rand()%numDummies;
for (i=0; i<numDummies; i++) {
// Fill the buffer randomly
for (j=0; j<32; j+=2)
*(randomData+j)=rand();
if (i==posRealOp)
function(data, key);
else
function(randomData, randomData+16);
}
#else
function(data, key);
#endif
}

View File

@ -0,0 +1,74 @@
/* aes.h */
/*
* This code is/was initially part of the AVR-Crypto-Lib. It is now
* stripped down such that only AES 128 encryption and decryption in
* CBC mode is supported.
*
* Copyright (C) 2016 alegen (alex@alegen.net)
* Copyright (C) 2006-2016 Daniel Otte (bg@nerilex.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AES_H_
#define AES_H_
#include <stdint.h>
/*
* The three types defined below are already array types
* and work as if they are pointers. No need to dereference
* variables of these types.
*/
typedef uint8_t* aes_state_t;
typedef uint8_t* aes_iv_t;
typedef uint8_t* aes_roundkey_t;
typedef uint8_t* aes_key_t;
#define AES_STATE_SIZE 16
#define AES_IV_SIZE 16
#define AES_ROUNDKEY_SIZE 16
#define AES_KEY_SIZE (16 * 11)
inline void aes_key_expansion(aes_key_t key);
#if AES_ENCRYPTION
inline void aes_ecb_encrypt(aes_state_t data, aes_key_t key);
inline void aes_cbc_encrypt(aes_state_t data, aes_iv_t, aes_key_t key);
#endif
inline void aes_ecb_decrypt(aes_state_t data, aes_key_t key);
inline void aes_cbc_decrypt(aes_state_t data, aes_iv_t, aes_key_t key);
void delay(uint16_t value);
#define LONGDELAY() delay(0x4FF);
#if ENABLE_RANDOMDELAY
#define RANDOMDELAY() random_delay(0x007F);
//#define SHORTRANDOMDELAY() random_delay(0x001F);
#define SHORTRANDOMDELAY() ;
void random_delay(uint16_t max_value);
#else
#define RANDOMDELAY() ;
#define SHORTRANDOMDELAY() ;
#endif
void executeWithDummies(void (*function)(uint8_t *, uint8_t *), uint8_t *data, uint8_t *key);
#endif

View File

@ -0,0 +1,119 @@
/* gf256mul.S */
/*
* This file is part of the AVR-Crypto-Lib.
* Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* For reference, the meaning of the 'f' character in behind labels in branch
* instruction refers to local labels. Read more about it here:
* http://www.atmel.com/webdoc/AVRLibcReferenceManual/FAQ_1faq_asmstabs.html
*
* The algorithm used in this implementation is the Russian Peasant
* Multiplication algorithm. Read more about it here:
* https://en.wikipedia.org/wiki/Ancient_Egyptian_multiplication
*/
#include <avr/io.h>
#define OPTIMIZE_SMALL_A
/*
* param a: r24
* param b: r22
* param reducer: r20
* return value: r24
*/
/*
* aliases for registers
*/
A = 23
B = 22
P = 24
.global gf256mul
#ifdef OPTIMIZE_SMALL_A
gf256mul:
; A = r24
mov A, r24
; r24 = 0
clr r24
1:
; A >> 1
; bit 0 is loaded into the C flag
; if result is 0, the Z flag is set
lsr A
; branch if Z flag is set
breq 4f
; branch if C flag is cleared
brcc 2f
; P = P xor B
eor P, B
2:
; B << 1
; bit 7 is loaded into the C flag
; if result is 0, the Z flag is set
lsl B
; branch if C flag is cleared
brcc 3f
; B = B xor r20
eor B, r20
3:
rjmp 1b
4:
; branch if C flag is cleared
brcc 2f
; P = P xor B
eor P, B
2:
ret
#else // OPTIMIZE_SMALL_A not defined
gf256mul:
; A = r24
mov A, r24
; r24 = 0
clr r24
; r25 = 0
ldi r25, 8
1:
; A >> 1
; bit 0 is loaded into the C flag
; if result is 0, the Z flag is set
lsr A
; branch if C flag is cleared
brcc 2f
; P = P xor B
eor P, B
2:
; B << 1
lsl B
; branch if C flag is cleared
brcc 3f
; B = B xor r20
eor B, r20
3:
; r25 -= 1
; if result is 0, the Z flag is set
dec r25
; branch if Z flag is not set
brne 1b
ret
#endif // OPTIMIZE_SMALL_A

View File

@ -0,0 +1,36 @@
/* gf256mul.h */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GF256MUL_H_
#define GF256MUL_H_
/**
* \author Daniel Otte
* \email bg@nerilex.org
* \date 2008-12-19
* \license GPLv3
* \brief
*
*
*/
#include <stdint.h>
uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer);
#endif /* GF256MUL_H_ */

View File

@ -0,0 +1,121 @@
/* RHme2
* Side Channel Analysis - SCAlate
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include "serial_io.h"
#include "aesProtected.h"
//For most platforms we want to use the AVR ADC-pins, since they have a seperate power rail
//This can be overridden elsewhere
#if TRIGGER==1
#define trigger_setup() DDRB = 0x20;
#define trigger_high() PORTB |= (1 << PORTB5);
#define trigger_low() PORTB &= ~(1 << PORTB5);
#else
#define trigger_setup()
#define trigger_low()
#define trigger_high()
#endif
uint8_t key[AES_KEY_SIZE];
uint8_t buf[AES_STATE_SIZE];
void fill_buf()
{
uint8_t i;
for(i = 0; i < 16; ++i) {
buf[i] = usart_recv_byte();
}
}
void send_buf()
{
uint8_t i;
for(i = 0; i < 16; ++i) {
usart_send_byte(buf[i]);
}
}
void encrypt()
{
trigger_high();
aes_ecb_encrypt(buf, key);
trigger_low();
}
void decrypt()
{
aes_ecb_decrypt(buf, key);
}
void aes_setup()
{
uint8_t aux[32] = {0x1c, 0x7b, 0x3f, 0x97, 0x83, 0xa4, 0x72, 0x55, 0xdb, 0x68, 0xb2, 0xd6, 0xe1, 0x9a, 0x9d, 0xd2};
int i;
for (i = 0; i < AES_KEY_SIZE; i++) {
key[i] = aux[i];
}
memset(aux, 0, sizeof(aux));
aes_key_expansion(key);
}
void random_setup()
{
static uint8_t initialized = 0;
// We XOR the stored seed with the input buffer for adding more entropy
// (assuming somebody doing SCA and randomizing the input)
if (initialized == 0) {
srand(eeprom_read_word(0) ^ (buf[0]<<8 | buf[1]));
initialized = 1;
}
}
int main(void)
{
uint8_t command;
serial_init();
trigger_setup();
aes_setup();
#ifdef DELAYS
random_setup();
#endif
while(1) {
command = usart_recv_byte();
switch(command) {
case 'e':
fill_buf();
random_setup();
encrypt();
send_buf();
break;
case 'd':
fill_buf();
random_setup();
decrypt();
send_buf();
break;
default:
continue;
}
}
return 0;
}

View File

@ -0,0 +1,375 @@
/* * main.c
*
* Created on: Jun 3, 2016
* Author: rhme
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <util/delay.h>
#ifdef __AVR__
#include <avr/pgmspace.h>
#else
#include <unistd.h>
#define serial_read(x, y) read(0, x, y)
#define serial_printf(...) printf(__VA_ARGS__);fflush(stdout)
#define serial_init(...)
#endif
#define USART_BAUDRATE 19200
#define BAUD_PRESCALER ( (F_CPU / (USART_BAUDRATE * 16UL)) - 1)
/**
* @brief Send a single byte.
* @param[in] byte Byte to send
*/
void usart_send_byte(uint8_t byte) {
/* Wait for empty transmit buffer */
while ( !(UCSR0A & (1 << UDRE0)) ) {
}
/* Send byte */
UDR0 = byte;
}
/**
* @brief Configure the USART0 port.
*/
void serial_init(void)
{
UBRR0H = (uint8_t)0;
UBRR0L = (uint8_t)51;
/* Enable received and transmitter */
UCSR0B = (1 << RXEN0) | (1 << TXEN0);
/* Set frame format (8N1) */
UCSR0C = (1 << UCSZ00) | (1 << UCSZ01);
UCSR0C &= ~(1 << UMSEL00);
UCSR0B |= (1 << RXCIE0);
//sei();
}
/**
* @brief Transmit a string.
* @param[in] s Null terminated string to send
*/
void usart_print(char *s)
{
//PORTB ^= (1 << PORTB5);
while (*s != 0) {
usart_send_byte( *(s++) );
/* Let the VM breath */
_delay_ms(1);
}
}
/**
* @brief Check for incomming data.
* @return 1 If there is data avaliable, 0 otherwise
*/
uint8_t usart_data_available(void)
{
if ( UCSR0A & (1 << RXC0) )
return 1;
return 0;
}
/**
* @brief Get incoming data.
* @return Received byte.
*/
uint8_t usart_recv_byte(void)
{
/* Wait until data is available */
while ( !usart_data_available() ){
}
//usart_send_byte('A');
/* Read byte */
return UDR0;
}
unsigned char input[0x10] = {0};
uint16_t checks = 0x0;
uint16_t stuff[256]; // Our ROP chain
void readinput(){
unsigned char c;
unsigned int idx;
for(idx=0; idx < sizeof(input)-1; idx++){
c = usart_recv_byte();
if (c == '\n' || c == '\r')
break;
//usart_print("Recevied\n");
input[idx] = c;
}
input[idx] = 0; // NULL terminate
}
void checklen(){
unsigned char i = 0;
for(i=0;input[i]; i++);
if (i == 13){
checks |= 1;
} else {
checks = 0;
}
}
void check7(){
if (input[7] + input[8] == '_'+'t'){
checks |= (1 << 8);
} else {
checks = 0;
}
}
void dummy1() {
if (input[7] * input[8] == input[9] + 'k') {
checks |= (1 << 13);
} else if (input[1] + input[2] + input[13] == 'e'+'y') {
checks |= (1 << 2);
checks |= (1 << 5);
} else {
checks |= (0 << 6);
}
}
void check12(){
volatile uint8_t i;
for(i=0;input[i];i++);
if (input[12] * i == '3'*13){
checks |= (1 << 13);
} else {
checks = 0;
}
}
void dummy2() {
if (input[3] + input[5] == input[9] * 'b') {
checks |= (1 << 12);
} else if (input[1] + input[2] + input[13] == 'n'*'i') {
checks |= (0 << 2);
checks |= (1 << 6);
} else {
checks |= (0 << 5);
}
}
void check9(){
if (input[9] + input[10] == '0'+'_'){
checks |= (1 << 10);
} else {
checks = 0;
}
}
void check4(){
if (input[4] * input[5] == '_'*'1'){
checks |= (1 << 5);
} else {
checks = 0;
}
}
void dummy3() {
if (input[11] - input[4] == input[7] * '3') {
checks |= (1 << 11);
} else if (input[1] + input[2] + input[13] == '2'*'5') {
checks |= (1 << 3);
checks |= (0 << 5);
} else {
checks |= (0 << 4);
}
}
void check3(){
if (input[3] + input[4] == '3' +'_'){
checks |= (1 << 4);
} else {
checks = 0;
}
}
void check10(){
if (input[10] * input[11] == 'm'*'_'){
checks |= (1 << 11);
} else {
checks = 0;
}
}
void dummy4() {
if (input[3] << input[2] == input[12] * 'v') {
checks |= (1 << 10);
} else if (input[1] + input[2] + input[13] == '6'*'q') {
checks |= (1 << 13);
checks |= (1 << 12);
} else {
checks |= (0 << 3);
}
}
void check6(){
if (input[6] * input[7] == 't'*'_'){
checks |= (1 << 7);
} else {
checks = 0;
}
}
void check1(){
if (input[1] + input[2] == 'v' +'1'){
checks |= (1 << 2);
} else {
checks = 0;
}
}
void check11(){
if (input[11] + input[12] == 'm'+'3'){
checks |= (1 << 12);
} else {
checks = 0;
}
}
void check0(){
if (input[0]*input[1] == 'g'*'1'){
checks |= (1 << 1);
} else {
checks = 0;
}
}
void check2(){
if (input[2] * input[3] == 'v'*'3'){
checks |= (1 << 3);
} else {
checks = 0;
}
}
void check8(){
if (input[8] * input[9] == 't'*'0'){
checks |= (1 << 9);
} else {
checks = 0;
}
}
void dummy5() {
if (input[6] >> input[10] == input[6] * 'm') {
checks |= (1 << 13);
} else if (input[1] + input[2] + input[13] == 'y'*'3') {
checks |= (1 << 12);
checks |= (0 << 13);
} else {
checks |= (0 << 2);
}
}
void check5(){
if (input[5] + input[6] == 't'+'1'){
checks |= (1 << 6);
} else {
checks = 0;
}
}
void dummy6() {
if (input[2] * input[1] == input[7] * 'u') {
checks |= (1 << 8);
} else if (input[4] + input[1] + input[7] == 's'*'r') {
checks |= (1 << 2);
checks |= (1 << 5);
} else {
checks |= (0 << 1);
}
}
void final(){
if ( checks == (1<<14)-1){
usart_print("\r\nFLAG:D0_you_3ven_ROP?");
usart_print("\r\n");
} else {
usart_print("\r\nBetter luck next time!\r\n");
}
}
void inline pivot(char *stuff) __attribute__((always_inline));
void inline pivot(char *stuff) {
asm volatile(
//"mov sp, r24\n\t"
"out 0x3D, R24\n\t" // SPL
"out 0x3E, R25\n\t" // SPH
"ret\n\t"
::);
}
void print_text(){
usart_print("Input: ");
}
volatile uint16_t ctr = 0;
void infloop(){
while(1);
}
void nop(){
ctr++;
}
#define SWAP(x) (( (x) >> 8) | (( (x) & 0xFF)<<8))
int main(void) {
volatile uint16_t idx = 256-40;
memset(stuff, 0x41, sizeof(stuff));
serial_init();
checks = 0;
//Initialize serial ports
stuff[idx++] = SWAP((uint16_t)&nop);
stuff[idx++] = SWAP((uint16_t)&print_text);
stuff[idx++] = SWAP((uint16_t)&readinput);
stuff[idx++] = SWAP((uint16_t)&checklen);
stuff[idx++] = SWAP((uint16_t)&check7);
stuff[idx++] = SWAP((uint16_t)&check8);
stuff[idx++] = SWAP((uint16_t)&check0);
stuff[idx++] = SWAP((uint16_t)&check2);
stuff[idx++] = SWAP((uint16_t)&check3);
stuff[idx++] = SWAP((uint16_t)&check6);
stuff[idx++] = SWAP((uint16_t)&check5);
stuff[idx++] = SWAP((uint16_t)&check9);
stuff[idx++] = SWAP((uint16_t)&check1);
stuff[idx++] = SWAP((uint16_t)&check10);
stuff[idx++] = SWAP((uint16_t)&check12);
stuff[idx++] = SWAP((uint16_t)&check4);
stuff[idx++] = SWAP((uint16_t)&check11);
stuff[idx++] = SWAP((uint16_t)&final);
stuff[idx++] = SWAP((uint16_t)&infloop);
// stuff[idx++] = SWAP((uint16_t)&dummy1);
// stuff[idx++] = SWAP((uint16_t)&dummy2);
// stuff[idx++] = SWAP((uint16_t)&dummy3);
// stuff[idx++] = SWAP((uint16_t)&dummy4);
// stuff[idx++] = SWAP((uint16_t)&dummy5);
// stuff[idx++] = SWAP((uint16_t)&dummy6);
pivot((char *)(&stuff[256-40]) - 1);
return 0;
}

View File

@ -0,0 +1 @@
g1v3_1t_t0_m3

View File

@ -0,0 +1,370 @@
/**
* RHme2
* Other - Emergency Transmitter
*
*/
#define F_CPU 16000000UL
#define USART_BAUDRATE 115200
#define BAUD_PRESCALER ( (F_CPU / (USART_BAUDRATE * 16UL)) - 1)
#define INBUFFER_LEN 16
#define CHR_LF 10
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/power.h>
#include <inttypes.h>
#include <string.h>
#include <stdlib.h>
#include "aes.h"
#include <stdio.h>
/************************/
/* Functions prototypes */
/************************/
void usart_send_byte(uint8_t byte);
void serial_init(void);
void usart_print(char *s);
void help(void);
void toggle_led(void);
void execute(void);
void login(void);
void encrypt(void);
void morse_print(uint8_t data);
void morse_flash(uint8_t data);
void aes_setup(void);
uint8_t usart_recv_byte(void);
uint8_t priv_chk(void);
/********************/
/* Global variables */
/********************/
aes_key_t key;
/* A complete command was received */
uint8_t parse_flag;
/* RX buffer */
uint8_t inbuffer[INBUFFER_LEN];
/* Current position inside INBUFFER_LEN */
uint8_t pos_inbuffer;
/* User admin status */
uint8_t admin;
/* Morse code table */
uint8_t mrs_table[16][10] = {"- - - - -", // 0x30 0
". - - - -", // 0x31 1
". . - - -", // 0x32 2
". . . - -", // 0x33 3
". . . . -", // 0x34 4
". . . . .", // 0x35 5
"- . . . .", // 0x36 6
"- - . . .", // 0x37 7
"- - - . .", // 0x38 8
"- - - - .", // 0x39 9
". -\x00*****", // 0x41 A
"- . . .\x00*", // 0x42 B
"- . - .\x00*", // 0x43 C
"- . .\x00***", // 0x44 D
".\x00*******", // 0x45 E
". . - .\x00*", // 0x46 F
};
/************************/
/* Function Definitions */
/************************/
int main(void)
{
uint32_t i;
aes_setup();
/* Set the clock to 2MHz to give more chances to properly inject the fault */
clock_prescale_set(clock_div_8);
/* Set the LED as output in the Data Direction Register */
DDRB = 0x20;
/* Initialize global variables. */
parse_flag = 0;
pos_inbuffer = 0;
admin = 0;
serial_init();
help();
usart_print("\r\n>> ");
/* Clean inbuffer so all the encryptions are deterministic */
for (i = 0; i < INBUFFER_LEN; i++) {
inbuffer[i] = 0;
}
/* Wait for commands */
while (1) {
if (parse_flag == 1) {
execute();
usart_print("\r\n>> ");
}
}
free(key);
return (0);
}
/**
* @brief aes_setup Set the key from the flag value
*/
void aes_setup(void)
{
uint8_t aux[32] = {0xa9, 0xea, 0x57, 0xa7, 0xec, 0xfd, 0x4d, 0x2f, 0x55, 0x6c, 0x81, 0x87, 0x99, 0x3d, 0x7b, 0x29};
int i;
key = (uint8_t*)malloc(AES_KEY_SIZE);
for (i = 0; i < AES_KEY_SIZE; i++) {
key[i] = aux[i];
}
memset(aux, 0, sizeof(aux));
}
/**
* @brief Send a single byte.
* @param[in] byte Byte to send
*/
void usart_send_byte(uint8_t byte) {
/* Wait for empty transmit buffer */
while ( !(UCSR0A & (1 << UDRE0)) ) {
}
/* Send byte */
UDR0 = byte;
}
/**
* @brief Configure the USART0 port.
*/
void serial_init(void)
{
/* Set baud rate */
UBRR0H = 0; //(uint8_t)(baud >> 8);
UBRR0L = 12;//(uint8_t) baud;
UCSR0A |= (1 << U2X0);
/* Enable received and transmitter */
UCSR0B = (1 << RXEN0) | (1 << TXEN0);
/* Set frame format (8N1) */
UCSR0C = (1 << UCSZ00) | (1 << UCSZ01);
UCSR0C &= ~(1 << UMSEL00);
UCSR0B |= (1 << RXCIE0);
sei();
}
/**
* @brief Transmit a string.
* @param[in] s Null terminated string to send
*/
void usart_print(char *s)
{
while (*s != 0) {
usart_send_byte( *(s++) );
/* Let the VM breathe */
_delay_ms(1);
}
}
/**
* @brief Check for incomming data.
* @return 1 If there is data avaliable, 0 otherwise
*/
uint8_t usart_data_available(void)
{
if ( UCSR0A & (1 << RXC0) )
return 1;
return 0;
}
/**
* @brief Get incoming data.
* @return Received byte.
*/
uint8_t usart_recv_byte(void)
{
/* Wait until data is available */
while ( !usart_data_available() ){
}
/* Read byte */
return UDR0;
}
/**
* @brief Display the help menu.
*/
void help(void)
{
usart_print(" \r\n");
usart_print("====== Jungle Assistance System V1.0 ======\r\n\r\n");
usart_print("This board will help you get out of the jungle in no time!\r\n");
usart_print("Write a message of maximum 16 bytes asking for help, the message\r\n");
usart_print("will be transmitted _encrypted_ using the LED and a secret key.\r\n");
usart_print("The key will remain secure even if the JAS falls into enemy\r\n\r");
usart_print("hands (We hope so).\r\n\r\n");
usart_print("As the LED is not powerful enough please aim carefuly.\r\n");
}
/**
* @brief UART receive interruption.
*
* Adds the received characters to te inBuffer and signals
* when a LF character is received so the command can be
* parsed.
*/
ISR(USART_RX_vect)
{
uint8_t data;
data = UDR0;
/* CHR_LF signals end of command */
if (data == CHR_LF) {
pos_inbuffer = 0;
parse_flag = 1;
} else if (pos_inbuffer < INBUFFER_LEN) {
inbuffer[pos_inbuffer] = data;
pos_inbuffer++;
}
}
/**
* @brief Toggle the led.
*/
void toggle_led(void)
{
PORTB ^= (1 << PORTB5);
}
/**
* @brief execute the received command
*/
void execute(void)
{
encrypt();
parse_flag = 0;
}
/**
* @brief Encrypt the message.
*/
void encrypt(void)
{
aes_state_t data = (aes_state_t) inbuffer;
uint32_t i;
aes_key_expansion(key);
aes_ecb_encrypt(data, key);
/* Print morse representation on the screen. */
// for (i = 0; i < 16; i++) {
// morse_print(data[i]);
// }
cli();
for (i = 0; i < 16; i++) {
morse_flash(data[i]);
}
sei();
/* If this is enabled, the data can be corrupted everywhere
* and it becomes TOO dificult to check if the fault is too
* late.
*/
// for (i = 0; i < 16; i++) {
// data[i] = 0;
// }
}
/**
* @brief morse_print Send the ascii dash-dot representation on the UART
* @param data Data do send in binary
*
* If data is 0xFA, then the morse code for F is send, and then the
* morse code for A.
*/
void morse_print(uint8_t data)
{
usart_print( (char *) mrs_table[ (data >> 4) & 0x0F ] );
usart_print(" ");
usart_print( (char *) mrs_table[ data & 0x0F ]);
usart_print(" ");
}
/**
* @brief morse_flash Flashes the led with a morse pattern.
* @param data Data to send in binary
*/
void morse_flash(uint8_t data)
{
uint8_t* morse_str;
uint8_t signal;
uint32_t e;
const uint32_t dot_time = 100;
/* Send the most significant nibble */
morse_str = mrs_table[ (data >> 4) & 0x0F ];
while (*morse_str) {
signal = *morse_str;
switch (signal) {
case '-':
PORTB ^= (1 << PORTB5);
for (e=dot_time * 3; e>0; e--);
PORTB ^= (1 << PORTB5);
break;
case '.':
PORTB ^= (1 << PORTB5);
for (e=dot_time; e>0; e--);
PORTB ^= (1 << PORTB5);
break;
}
for (e=dot_time; e>0; e--);
morse_str++;
}
/* At the end of the letter a silence of 3 dots is expected 3 */
for (e = dot_time *4; e > 0; e--);
/* Send the second nibble */
morse_str = mrs_table[ data & 0x0F ];
while (*morse_str) {
signal = *morse_str;
switch (signal) {
case '-':
PORTB ^= (1 << PORTB5);
for (e=dot_time * 3; e>0; e--);
PORTB ^= (1 << PORTB5);
break;
case '.':
PORTB ^= (1 << PORTB5);
for (e=dot_time; e>0; e--);
PORTB ^= (1 << PORTB5);
break;
}
for (e = dot_time; e > 0; e--);
morse_str++;
}
/* At the end of the letter a silence of 3 dots is expected 3 */
for (e = dot_time * 4; e > 0; e--);
}

View File

@ -0,0 +1,120 @@
/* RHme2
* Side Channel Analysis - Still Not SCAry
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include "serial_io.h"
#include "aesProtected.h"
//For most platforms we want to use the AVR ADC-pins, since they have a seperate power rail
//This can be overridden elsewhere
#if TRIGGER==1
#define trigger_setup() DDRB = 0x20;
#define trigger_high() PORTB |= (1 << PORTB5);
#define trigger_low() PORTB &= ~(1 << PORTB5);
#else
#define trigger_setup()
#define trigger_low()
#define trigger_high()
#endif
uint8_t key[AES_KEY_SIZE];
uint8_t buf[AES_STATE_SIZE];
void fill_buf()
{
uint8_t i;
for(i = 0; i < 16; ++i) {
buf[i] = usart_recv_byte();
}
}
void send_buf()
{
uint8_t i;
for(i = 0; i < 16; ++i) {
usart_send_byte(buf[i]);
}
}
void encrypt()
{
trigger_high();
aes_ecb_encrypt(buf, key);
trigger_low();
}
void decrypt()
{
aes_ecb_decrypt(buf, key);
}
void aes_setup()
{
uint8_t aux[32] = {0x89, 0x32, 0xd0, 0xb8, 0x10, 0x16, 0x85, 0x14, 0x53, 0x4b, 0x93, 0xbe, 0x48, 0x2c, 0xdf, 0x21};
int i;
for (i = 0; i < AES_KEY_SIZE; i++) {
key[i] = aux[i];
}
memset(aux, 0, sizeof(aux));
aes_key_expansion(key);
}
void random_setup()
{
static uint8_t initialized = 0;
// We XOR the stored seed with the input buffer for adding more entropy
// (assuming somebody doing SCA and randomizing the input)
if (initialized == 0) {
srand(eeprom_read_word(0) ^ (buf[0]<<8 | buf[1]));
initialized = 1;
}
}
int main(void)
{
uint8_t command;
serial_init();
trigger_setup();
aes_setup();
#ifdef DELAYS
random_setup();
#endif
while(1) {
command = usart_recv_byte();
switch(command) {
case 'e':
fill_buf();
random_setup();
encrypt();
send_buf();
break;
case 'd':
fill_buf();
random_setup();
decrypt();
send_buf();
break;
default:
continue;
}
}
return 0;
}

View File

@ -0,0 +1,364 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#define __AVR_ATmega328P__ 1
#include <avr/io.h>
#include <util/delay.h>
#define USART_BAUDRATE 19200
#define BAUD_PRESCALER ( (F_CPU / (USART_BAUDRATE * 16UL)) - 1)
#include "aes.h"
/**
* @brief Send a single byte.
* @param[in] byte Byte to send
*/
void usart_send_byte(uint8_t byte) {
/* Wait for empty transmit buffer */
while ( !(UCSR0A & (1 << UDRE0)) ) {
}
/* Send byte */
UDR0 = byte;
}
/**
* @brief Configure the USART0 port.
*/
void serial_init(void)
{
/* Set baud rate */
UBRR0H = (uint8_t)0;
UBRR0L = (uint8_t)51;
/* Enable received and transmitter */
UCSR0B = (1 << RXEN0) | (1 << TXEN0);
/* Set frame format (8N1) */
UCSR0C = (1 << UCSZ00) | (1 << UCSZ01);
UCSR0C &= ~(1 << UMSEL00);
UCSR0B |= (1 << RXCIE0);
//sei();
}
/**
* @brief Transmit a string.
* @param[in] s Null terminated string to send
*/
void usart_print(char *s)
{
while (*s != 0) {
usart_send_byte( *(s++) );
/* Let the VM breathe */
_delay_ms(1);
}
}
/**
* @brief Check for incomming data.
* @return 1 If there is data avaliable, 0 otherwise
*/
uint8_t usart_data_available(void)
{
if ( UCSR0A & (1 << RXC0) )
return 1;
return 0;
}
/**
* @brief Get incoming data.
* @return Received byte.
*/
uint8_t usart_recv_byte(void)
{
/* Wait until data is available */
while ( !usart_data_available() ){
}
/* Read byte */
return UDR0;
}
char prbuff[120];
void serial_printf(const char *format, ...)
{
va_list args;
va_start(args, format);
vsnprintf(prbuff, 120, format, args);
usart_print(prbuff);
va_end(args);
}
static uint8_t append_char(char *str, uint8_t ch, uint8_t k, uint8_t max)
{
usart_send_byte(ch);
if (k < max - 1)
str[k++] = ch;
return k;
}
uint8_t usart_read_str(char *str, uint8_t max) {
uint8_t k, eos, ch; // , ch2
k = 0; // index of first free position in the string
eos = 0; // end of string, used as boolean
while (!eos) {
ch = usart_recv_byte();
if (ch == '\r') {
eos = 1;
} else if (ch == '\n') {
// do nothing
} else {
k = append_char(str, ch, k, max);
}
}
// terminate string accordingly
str[k] = '\0';
/* return input length */
return k;
}
// Initializes ACD to read the PINS
void InitADC()
{
ADMUX=(1<<REFS0); // For Aref=AVcc;
ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); //Rrescalar div factor =128
}
// Takes a number of a PIN between 0x00 and 0x07
// Rerurns the value of the input on the PIN
uint16_t ReadADC(uint8_t ch)
{
//Select ADC Channel ch must be 0-7
ch=ch&0b00000111;
ADMUX|=ch;
//Start Single conversion
ADCSRA|=(1<<ADSC);
//Wait for conversion to complete
while(!(ADCSRA & (1<<ADIF)));
ADCSRA|=(1<<ADIF);
return(ADC);
}
// Checks a password and leaks a timing information
int compPasswords(char* pass, char* inp)
{
int i;
if (inp[0] == '\r' || inp[0] == '\n') {
inp++;
}
if (strlen(pass) != strlen(inp)) {
//serial_printf("Wrong");
return 0;
}
for (i = 0; i < strlen(pass); i++) {
_delay_ms(1);
if (pass[i] != inp[i]) {
return 0;
}
}
return 1;
}
void delayVar(uint8_t d)
{
int i;
for (i = 0; i < d; i++) {
_delay_ms(1);
}
}
// Generates a super true random nonce by reading Analog Pin 3
// After six readings the array is encrypted using AES
// Returns 16 bytes random nonce
void getNonce(uint8_t *output)
{
aes_key_t key;
key = (uint8_t*)malloc(AES_KEY_SIZE);
key[0] = ReadADC(0x03);
_delay_ms(1);
key[1] = ReadADC(0x03);
_delay_ms(1);
key[2] = ReadADC(0x03);
_delay_ms(1);
key[3] = ReadADC(0x03);
_delay_ms(1);
key[4] = ReadADC(0x03);
_delay_ms(1);
key[5] = ReadADC(0x03);
_delay_ms(1);
key[6] = ReadADC(0x03);
key[ 7] = 0;
key[ 8] = 0;
key[ 9] = 0;
key[10] = 0;
key[11] = 0;
key[12] = 0;
key[13] = 0;
key[14] = 0;
key[15] = 0;
output[ 0] = key[0];
output[ 1] = key[1];
output[ 2] = key[2];
output[ 3] = key[3];
output[ 4] = key[4];
output[ 5] = key[5];
output[ 6] = key[6];
output[ 7] = 0;
output[ 8] = 0;
output[ 9] = 0;
output[10] = 0;
output[11] = 0;
output[12] = 0;
output[13] = 0;
output[14] = 0;
output[15] = 0;
aes_key_expansion(key);
aes_ecb_encrypt(output, key);
free(key);
}
int main(void)
{
serial_init();
_delay_ms(10);
char secretPass[16] = {'T', 'I', 'm', 'I', 'n', 'G', '@', 't', 't', 'A', 'k', 'w', '0', 'r', 'k', 0x00}; // -- RANDOMIZE later
char inputBuff[32] = {0};
unsigned char authL0 = 0;
char flag[16] = {'T', 'o', '0', '_', 'm', 'u', 'c', 'h', '_', '3', 'n', 't', 'r', 'o', 'p', 'y'};
int inpLen = 0;
int i;
int j;
InitADC();
uint8_t in[50] = { 0x00 };
uint8_t iv[16] = {0};
uint8_t enc[16] = {0};
uint8_t res[50] = {0};
aes_key_t key;
key = (uint8_t*)malloc(AES_KEY_SIZE);
key[ 0] = 0x39;
key[ 1] = 0x27;
key[ 2] = 0xCD;
key[ 3] = 0x37;
key[ 4] = 0xC4;
key[ 5] = 0xAF;
key[ 6] = 0xE4;
key[ 7] = 0x6C;
key[ 8] = 0xFA;
key[ 9] = 0xC2;
key[10] = 0xAB;
key[11] = 0x3E;
key[12] = 0x21;
key[13] = 0xAA;
key[14] = 0x4E;
key[15] = 0x71;
aes_key_expansion(key);
if (authL0 == 0) {
serial_printf("Welcome to Secure Encryption System(SES)!\n");
serial_printf("Authentication step.\n");
serial_printf("Input provided secret password.\n");
serial_printf("If you lost your password call the customer service.\n");
while (1) {
serial_printf(">");
inpLen = usart_read_str(inputBuff, 20);
if (inpLen < 20) {
inputBuff[inpLen] = '\0';
} else {
inputBuff[19] = '\0';
}
serial_printf("\nChecking password...\n");
if (compPasswords(secretPass, inputBuff) == 0) {
serial_printf("Password is incorrect!\n");
} else {
serial_printf("Password is correct!\n");
authL0 = 7;
_delay_ms(500);
break;
}
}
}
if (authL0 == 7) {
serial_printf("\n\n************************************************\n");
serial_printf("Authentication complete. Welcome to the system!\n");
serial_printf("Now you can encrypt messages up to 32 bytes.\n");
while (1) {
serial_printf("Input data to encrypt:\n");
serial_printf("> ");
inpLen = usart_read_str((char *) in, 33); // read up to 32 byte input
// Append secret flag after
for (i = 0; i < 16; i++) {
in[i+inpLen] = flag[i];
}
// Zero the rest just in case
for (i = (16 + inpLen); i < 50; i++) {
in[i] = 0x00;
}
getNonce(iv);
serial_printf("\nTrue Random Nonce:\t");
for (i = 0; i < 16; i++) {
serial_printf("%02x", iv[i]);
}
serial_printf("\n");
uint8_t block = 0;
for (i = 0; i < (16 + inpLen); i+=16) {
iv[15] ^= block; // IV XORed with a block counter which is at most 3.
memcpy(enc, iv, 16);
aes_ecb_encrypt(enc, key);
for (j = 0; j < 16; j++) {
res[block*16+j] = enc[j] ^ in[block*16+j];
}
block++;
}
serial_printf("Encryption:\t");
for (i = 0; i < block*16; i++) {
serial_printf("%02x", res[i]);
}
serial_printf("\n");
}
}
free(key);
return 0;
}

View File

@ -0,0 +1,119 @@
/* RHme2
* Side Channel Analysis - Piece of SCAke
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include "serial_io.h"
#include "aesProtected.h"
//For most platforms we want to use the AVR ADC-pins, since they have a seperate power rail
//This can be overridden elsewhere
#if TRIGGER==1
#define trigger_setup() DDRB = 0x20;
#define trigger_high() PORTB |= (1 << PORTB5);
#define trigger_low() PORTB &= ~(1 << PORTB5);
#else
#define trigger_setup()
#define trigger_low()
#define trigger_high()
#endif
uint8_t key[AES_KEY_SIZE];
uint8_t buf[AES_STATE_SIZE];
void fill_buf()
{
uint8_t i;
for(i = 0; i < 16; ++i) {
buf[i] = usart_recv_byte();
}
}
void send_buf()
{
uint8_t i;
for(i = 0; i < 16; ++i) {
usart_send_byte(buf[i]);
}
}
void encrypt()
{
trigger_high();
aes_ecb_encrypt(buf, key);
trigger_low();
}
void decrypt()
{
trigger_high();
aes_ecb_decrypt(buf, key);
trigger_low();
}
void aes_setup()
{
uint8_t aux[32] = {0xaf, 0x23, 0xd5, 0x45, 0xa0, 0xea, 0xe6, 0xa0, 0x74, 0x65, 0x96, 0xca, 0xce, 0x51, 0xf0, 0xf7};
int i;
for (i = 0; i < AES_KEY_SIZE; i++) {
key[i] = aux[i];
}
memset(aux, 0, sizeof(aux));
aes_key_expansion(key);
}
void random_setup()
{
static uint8_t initialized = 0;
// We XOR the stored seed with the input buffer for adding more entropy
// (assuming somebody doing SCA and randomizing the input)
if (initialized == 0) {
srand(eeprom_read_word(0) ^ (buf[0]<<8 | buf[1]));
initialized = 1;
}
}
int main(void)
{
uint8_t command;
serial_init();
trigger_setup();
aes_setup();
while(1) {
command = usart_recv_byte();
switch(command) {
case 'e':
fill_buf();
random_setup();
encrypt();
send_buf();
break;
case 'd':
fill_buf();
random_setup();
decrypt();
send_buf();
break;
default:
continue;
}
}
return 0;
}

View File

@ -0,0 +1,310 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <util/delay.h>
#define USART_BAUDRATE 19200
#define BAUD_PRESCALER ( (F_CPU / (USART_BAUDRATE * 16UL)) - 1)
#define KB_ENTER 0x0D
char str[100];
int numbers [6];
/**
* @brief Send a single byte.
* @param[in] byte Byte to send
*/
void usart_send_byte(uint8_t byte) {
/* Wait for empty transmit buffer */
while ( !(UCSR0A & (1 << UDRE0)) ) {
}
/* Send byte */
UDR0 = byte;
}
/**
* @brief Configure the USART0 port.
*/
void serial_init(void)
{
/* Set baud rate */
//uint16_t baud = BAUD_PRESCALER;
UBRR0H = (uint8_t)0;
UBRR0L = (uint8_t)51;
/* Enable received and transmitter */
UCSR0B = (1 << RXEN0) | (1 << TXEN0);
/* Set frame format (8N1) */
UCSR0C = (1 << UCSZ00) | (1 << UCSZ01);
UCSR0C &= ~(1 << UMSEL00);
UCSR0B |= (1 << RXCIE0);
//sei();
}
/**
* @brief Transmit a string.
* @param[in] s Null terminated string to send
*/
void usart_print(char *s)
{
//PORTB ^= (1 << PORTB5);
while (*s != 0) {
usart_send_byte( *(s++) );
/* Let the VM breath */
_delay_ms(1);
}
}
/**
* @brief Check for incomming data.
* @return 1 If there is data avaliable, 0 otherwise
*/
uint8_t usart_data_available(void)
{
if ( UCSR0A & (1 << RXC0) )
return 1;
return 0;
}
/**
* @brief Get incoming data.
* @return Received byte.
*/
uint8_t usart_recv_byte(void)
{
/* Wait until data is available */
while ( !usart_data_available() ){
}
/* Read byte */
return UDR0;
}
char prbuff[120];
void serial_printf(const char *format, ...) {
va_list args;
va_start(args, format);
vsnprintf(prbuff, 120, format, args);
usart_print(prbuff);
va_end(args);
}
static uint8_t append_char(char *str, uint8_t ch, uint8_t k, uint8_t max) {
usart_send_byte(ch);
if (k < max - 1)
str[k++] = ch;
return k;
}
uint8_t usart_read_str(char *str, uint8_t max) {
uint8_t k, eos, ch;
k = 0; // index of first free position in the string
eos = 0; // end of string, used as boolean
while (!eos) {
ch = usart_recv_byte();
if (ch == '\r') {
eos = 1;
}
else {
k = append_char(str, ch, k, max);
}
}
// terminate string accordingly
str[k] = '\0';
/* return input length */
return k;
}
void toggle_led(void)
{
PORTB ^= (1 << PORTB5);
}
int monitorPins(int timeout) {
int i;
int res;
int pin = -1;
int pinTriggered = 0;
int diff = 0;
while (diff <= timeout && pinTriggered == 0){
res = (PINB<<8)+PIND;
if (res > 3) {
//serial_printf("Result: %d\r\n", res);
for (i=0;i<6;i++) {
int bit = (res >> (numbers[i])) & 1;
if (bit==1 && pinTriggered == 0) {
pin = numbers[i];
pinTriggered = 1;
}
else if (bit == 1 && pinTriggered == 1) {
pinTriggered = 2;
pin = -1;
}
}
}
diff += 20;
_delay_ms(20);
}
return pin;
}
int whack_it() {
int success;
int blink;
unsigned int rnd;
int timeout;
for (success=0; success<51; success++) {
if (success == 0) {
serial_printf("\r\nReady?\r\n");
_delay_ms(1000);
serial_printf("\r\nGet set!\r\n");
_delay_ms(1000);
serial_printf("\r\nGO!\r\n");
timeout = 5000;
}
else {
timeout = timeout / 2;
}
blink = 1;
rnd = rand() % 6 + 1;
while (blink <= rnd) {
toggle_led();
_delay_ms(50);
toggle_led();
_delay_ms(50);
blink++;
}
_delay_ms(4);
int triggered = monitorPins(timeout);
if (triggered == numbers[rnd-1]) {
if (success == 50) {
return 0xCAFE;
}
sprintf(str, "Great job. You whacked it. Only %d more to go.\r\n", 50 - success);
usart_print(str);
_delay_ms(50);
}
else {
usart_print("You missed it. Try again by pressing <Enter>.\r\n");
while (usart_recv_byte() != KB_ENTER) {}
success = -1;
}
}
return 0;
}
int pins() {
int res = 0;
int i=0;
for (i=0;i<6;i++) {
numbers[i] = -1;
}
i = 0;
int tmp, j;
//usart_print("Pin layout:\r\n");
while (numbers[5] == -1) {
tmp = rand()%11+2;
for (j=0; j<6;j++) {
if (tmp == numbers[j]) {
break;
}
else if (j==5) {
numbers[i] = tmp;
i++;
res = 0xBABE;
}
}
}
return res;
}
int random_setup() {
static uint8_t initialized=0;
if (initialized == 0) {
srand(eeprom_read_word(0));
eeprom_write_word(0, rand() ^ 0xBEEFBEFF);
initialized=1;
return 0xDEAD;
}
return 0;
}
int main(void) {
serial_init();
//set LED as output
DDRB = 0x20;
//return value checking code.
int res;
serial_printf("\r\nWelcome adventurer.\r\n\r\n");
serial_printf("We are glad you are here. We are in dire need of assistence.\r\n");
serial_printf("A huge family of moles have found their way into our yard.\r\n");
serial_printf("We need you to get rid of all 20 of them.\r\n");
serial_printf("If you manage to extinguish them all we will greatly reward you.\r\n");
serial_printf("When you are ready, please step into the yard by pressing <Enter>\r\n");
while (usart_recv_byte() != KB_ENTER) {}
res = random_setup();
if (res != 0xDEAD) {
return 0;
}
res = pins();
if (res != 0xBABE) {
return 0;
}
//double check here, just in case we glitch this one.
//also, random delay in there, because why not.
res = whack_it();
if (res == 0xCAFE) {
int i = 0;
int rnd = rand()%500;
while (i < rnd ) {
i++;;
_delay_ms(1);
}
if (~res == 0x3501) {
serial_printf("\r\nWhat? You managed to get them all already?\r\n");
serial_printf("We are most gratefull for your service.\r\n");
serial_printf("Please take our most precious belonging.\r\n");
serial_printf("FLAG:S4v3d_the_f4rm!");
return 0;
}
}
usart_print("Failed.\r\n");
return 0;
}