ARM Reverse Engineering (Part 31 – Hacking Float Variables)
Kevin Thomas
Author of the world’s most popular Reverse Engineering Tutorial
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in addition to the topics it will cover. https://github.com/mytechnotalent/Reverse-Engineering-Tutorial
Let’s re-examine our code.
#include <iostream> int main(void) { int myNumber = 1337.1; std::cout << myNumber << std::endl; return 0;}Let’s review last week’s tutorial.
Let’s break onmain+20 and continue to that point.
Let’s examine what value is insider11-8. We clearly see it is1337.09998 which approximates our value in our original c++ code. Keep in mind a float has roughly 7 decimal digits of precision and that is why we do not see1337.1 so please remember that as we go forward.
We can also see this value in high memory.
Let’s break onmain+28 and continue.
We see a strange new instruction. We seevldr and the value withinr11, #8 being moved into s0. So what iss0? We have a math co-processor which has a series of additional registers that work with decimal or floating-point numbers. Here we see an example of such to which the value of1337.09998is being moved intos0. Thevldr instruction loads a constant value into every element of a single-precision or double-precision register such as s0.
We can only see these special registers if we do a info registers all command as we do below.
Below we see the value now being moved intos0.
Let’s hack!
Let’s now look at the registers and see what has transpired.
As you can see we have hacked the value (less the precision issue of the float variable accurate up to 6 decimal places)!
Finally as we continue we see our hacked value echoed back out to the terminal when the c++coutfunction executes.
Next week we will dive into Double Variables.
To view or add a comment,sign in
More articles by Kevin Thomas
- Modern Test Automation - Episode 0x0002: Unit vs Integration EngineeringJan 27, 2023
Modern Test Automation - Episode 0x0002: Unit vs Integration Engineering
In a given modern Kubernetes software architecture, we see a number of pods to which may have a container or a number…
- Modern Test Automation - Episode 0x0001: Will ChatGPT Take My Job?Jan 18, 2023
Modern Test Automation - Episode 0x0001: Will ChatGPT Take My Job?
Let me ask you a question, if I were to ask you if you would allow a complete stranger to pick up your kids from school…
6 Comments - Why the Software Engineer in Test career is SO important today!Jun 29, 2022
Why the Software Engineer in Test career is SO important today!
I remember in the 80's where we would write software in Assembly Language and pride ourselves with the fact that…
- Pico Hacking (Part 20 - Debugging Input)Jun 4, 2021
Pico Hacking (Part 20 - Debugging Input)
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in…
- Pico Hacking (Part 19 - Input)May 28, 2021
Pico Hacking (Part 19 - Input)
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in…
- Pico Hacking (Part 18 - "FOR 800 YEARS HAVE I TRAINED JEDI!", The FORCE That IS Input...)May 21, 2021
Pico Hacking (Part 18 - "FOR 800 YEARS HAVE I TRAINED JEDI!", The FORCE That IS Input...)
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in…
- Pico Hacking (Part 17 - "ABSOLUTE POWER CORRUPTS ABSOLUTELY!", The Tragic Tale Of Input...)May 20, 2021
Pico Hacking (Part 17 - "ABSOLUTE POWER CORRUPTS ABSOLUTELY!", The Tragic Tale Of Input...)
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in…
- Pico Hacking (Part 16 - Hacking double)May 7, 2021
Pico Hacking (Part 16 - Hacking double)
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in…
- Pico Hacking (Part 15 - Debugging double)Apr 19, 2021
Pico Hacking (Part 15 - Debugging double)
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in…
- Pico Hacking (Part 14 - double)Apr 16, 2021
Pico Hacking (Part 14 - double)
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in…
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development