This exercise is very similar to the previous one, with two differences. First, the string should be passed as an argument. Second, the modified variable should be set to a certain value (0x61626364).

The important point here is that the architecture is little endian. this means that if we pass four charaters, those bytes will be stored in reverse order. We have to pass 0x64, 0x63, 0x62, 0x61 to set the modified value to 0x61626364.

0x64, 0x63, 0x62, 0x61 is actually ‘d’, ‘c’, ‘b’, ‘a’. The solution:

/opt/protostar/bin/stack1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdcba

screen-shot-2016-11-26-at-19-24-09