《Grand Simulation》Chapter 13 - Timing Attack
Advertisement
test = echo "Hello, World!"
“Test,” I whispered. A new window opened up.
Hello, World!
I was almost certain that it would work but still sighed in relief. Then I quickly modified the program, coming to the crux of the issue.
test = sudo echo "Hello, World!"
I took a deep breath. Crossed my fingers. Whispering with my eyes closed, “Test”. I opened a single eye and my lips unconsciously curled into a smile.
Password:
‘Hallelujah!’ I celebrated in my mind. There is a superuser!
“So it worked?” Arya asked out of nowhere. I beamed at her blankly for a moment. “You did your evil smirk again,” she clarified.
“Okay, first off, it is a normal smile. And second, yes. I got want I was looking for. As for whether I can use it or not, the jury is still out on that one,” I said.
“So, can you tell me now what the spell is?” she beamed back. She had grown peculiarly interested in programming. ‘Perhaps she wants to make a powerful resurrection spell or something?’
“Okay. In normal computing, there is a concept of a superuser, who can do stuff normal users cannot. Ummm, for example, think of a corporate building. You have your cleaners, workers, security, and so on. Many people with various roles and access to different rooms and tools. Then there is the owner or an administrator of the building. That one has access to all the rooms and all the stuff of the building. A superuser is something like the administrator. I mean, bad example but close enough. In Windows, the user is called an Administrator; on Unixes it is called a ‘root’ user,” I tried to explain.
“Ah, I understand. So, what has your spell got to do with an administrator?” she asked.
Advertisement
“Hmm, well you must know by now that these spells are nothing but programs, right? If I can get superuser rights, then -“
“Then you can access tools and do stuff that you normally couldn’t!” she cut me off and concluded.
“Well, yes,” I replied. ‘She is quick on the uptake.’
“So how do you become an admin?” she continued.
“That is the problem. You need a password,” I said with a bitter smile.
“And how will we get this password?” she prompted unabashed.
‘Brute force? Nah, I don’t have years to spare for it to complete. I don’t have handy dictionary either. Hmm, will it be susceptible to attacks though? Even our Earthly systems are so air-tight for the most part, this is an alien super system we are talking about. Maybe…’
“I’m gonna try something called as timing attack.” I paused, rearranging my thoughts. “It works by checking the time of a system’s response against different inputs. Imagine you entered a fully wrong password, like all characters incorrect. And the system denies entry after processing for a bit. Now, you enter a wrong password again, but half your characters are matching the real password. System will deny you entry again, but the time it takes to process your input will vary.”
“I don’t get it, why will the time be different? And how will it give us the password?” she asked.
“Hmm, perhaps an example will help? Assume the real password is ‘abcd’. And the system checks each letter of your input against the real one when verifying. Now, if you enter ‘wxyz’, the system matches ‘w’ as first input against ‘a’, which is incorrect, so it immediately denies request. Next, you put in ‘axyz’. It will check if letter of input ‘a’ with real pass ‘a’, give okay, move on to next letter ‘x’ and match against ‘b’. It denies again here but the time it took to deny was more that of before because it took more time to process the correct input at the start. Thus, you unravel each letter one by one until your ‘wxyz’ turns into ‘abcd’ and voila - you have the password!”
Advertisement
“Oh wow, that is some neat trick.” She reflected one it for a while. “Hey, my mana is back up, I’m gonna go cast heal. Best of luck with the password.” She went back to her grind. I went back to mine.
¤ ¤ ¤
I was pessimistic. Good thing I had nothing but time on my hands - at least until Arya leveled up. I decided to give some random words a try first, you never know.
Password: password
I added the password with a thought. The window just vanished. No ‘Hello, World!’. I noticed I was down 2 mana. ‘Come on, I’m not even doing anything!’ I wailed.
More determined than ever, I tried several more variations. No dice.
‘I can’t manually keep entering a password. A few more and I’ll forget what I entered previously. Nor would I be able to cover all the characters.’ With that thought, I decided to automate it.
test = while true; do echo "password" | sudo -S echo "password worked"; done;
I cast the spell. One mana point down. I didn’t see the window prompting for the password. Another second down, another mana point gone.
‘What is this? A background job? I see. Since the system is unable to determine how many resources this spell will consume, it is taking it in as it requires,’ I mused. ‘Alright, now that we have a loop, let us get our characters in! First, I need a loop going from 0 to 255 to cover all chars. And I need to stream the output into a file.’
test = i=0; while [ $i -le 255 ]; do; echo "$i" >> password_hack | sudo -S echo; done;
‘Now, instead of taking in numbers, let us feed it characters. Maybe the old printf trick?’
get_char i = printf "\x$(printf %x $i)"
‘Alright, this will take a decimal i and return the corresponding character. Next is… ah right, the “time” function.’
get_time = date +%s%N
‘Right, so this will give us time in nanoseconds. Now to put it all together…’
test = i=0; while [ $i -le 255 ]; do; echo "$(get_char $i) $(get_time)" >> password_hack | sudo -S echo; done; get_char i = printf "\x$(printf %x $i)" get_time = date +%s%N
I ran each function and made sure everything worked. By the time I was done, Arya was looking fixedly at me again. “You were gone for quite a while just now. How’s the password hacking going?” she queried. I was getting used to her being a curious cat by now, so I simply replied: “I’ve got the code down, I think. But I don’t have the mana required to run it to the end right now. Maybe later? Quite a shot in the dark though, I don’t expect much,” I sated her curiosity, “Are you done?” I queried in return. “Yep, I’m level 3 now!” she exclaimed. “Congratulations,” I smiled in return. “Should we wake the others now or do you wanna rest some?” “Nah, let’s get going,” she declared. And so, we woke the others and got going.
Advertisement
- In Serial10 Chapters
Bunkercore
(Update: This is now a published story: You can find it here; https://www.royalroad.com/amazon/B07HKV8BRN Pursuant to Kindle Select TOS, I have pruned the existing story present on this site down to less than 10% of the book's total size. As such, it is compliant with all applicable Amazon rules and regulations.) Wynne might have been human once. It's hard to say. Now he's a bunker core, a nanomachine controller responsible for an entire complex. Of course, the place is a bit wrecked. And the world outside is ruins. And he's pretty sure that whoever put him here is going to come looking for him at some point... Dungeon Core, Post-apocalyptic style. Come for the mutants, stay for the dystopian adventure! Claimer: My name is Andrew Seiple. I write this story, and I own the rights to it. It is posted on Spacebattles.com and Sufficientvelocity.com, as well as royalroadl.comCover art by Amelia Parris.
8 65 - In Serial33 Chapters
The Boneless Dungeon
Breck was living in an overpopulated grim future before an accident at work broke his bones and killed him. Before he died, he received odd messages awarding him skills and abilities. Little did he know that he was about to be reborn as a dungeon core, a specialized living gem in charge of creating and managing a dungeon. A dungeon handicapped with the inability to create bones, the very building blocks that comprise most living creatures. Breck just wants his life back, his humanity, and will do whatever it takes to achieve his goal. His trusty AI companion from Earth gives him hope of becoming human again if he can gain enough ranks to transcend.Zach is a new adventurer at the lowest ranks. Because of a random turn of events, he is given the opportunity of a lifetime. A quest to find the source of new cosmic energy that has made itself known, the same cosmic energy that creates dungeon cores. This quest was created directly from the head of the adventurer’s guild and offers a high payout. This could be the lucky break he needs to make something of himself. That is, if others allow him to complete it alive.Can Breck gain enough essence to rank up and become human again? Can he create a competent dungeon without the ability to create bones? Will Zach be able to complete his quest while other guild members are hunting him? Can the new adventurer gain the skills to pay the bills? What happens when their paths collide? Find all this out and more in this exciting GameLit, The Boneless Dungeon: Rebirth.
8 348 - In Serial7 Chapters
Tales From Elsewhere
*Currently on Hiatus due to a new project* Tales From Elswhere is a collection of short stories. They are short burst of flavors that consist of different worlds and characters. When a Tale is weaved a new one unfolds, but a fragmented tale will continue to be told. A new tale will be released once or twice in one month. Thanks having patience and i hope you get cozy as you read through them.
8 139 - In Serial16 Chapters
Hellbound
The System has arrived, Heaven and Hell will follow. And for Sarah Rose, Hell will be following very very closely. Accompany our protagonist as she struggles to survive in a game-like apocalypse, assisted by friends, foes, the System and your average cynical neighbourhood demon lord.
8 129 - In Serial47 Chapters
Devourer
A group of rookie adventurers enter an ancient tomb in the hopes finding treasureWithin they found something priceless but it is not something they expectedWithin lay an egg that held a species that existed since life beganA species wiped out long agoA species that only lives in tales, songs and legendsA species that can become more powerful than any otherWith the opening of the tomb the adventurers will release this creature out into the worldThey will release me into their worldIn my past life I was powerless and abusedNow I can become more powerful than any otherAnd I am very hungry...
8 195 - In Serial27 Chapters
12 Days in the Psych Ward
This is a poetry/journal book about my experience in the Psych Ward. It's all true accounts with names changed for privacy. I wrote this while in the ward, except for the last day. Please take care in reading. If topics of suicide, depression, rape, molestation, and other possible topics are triggering for you, this may not be suitable to be read.[This poetry book is completed ✔]Ranking:#1 in poetry#4 in poem#10 in nonfiction#16 in Short story
8 188