Lets assume that i wrote program in .c and that end user is starting .exe file. During program's execution there is variable called CHECK that gets dynamically assigned in middle of program's execution using some pseudo random algorithms. In one point, if the variable matches some criteria (lets say CHECK == 1580 or some static predifined number) the program does something on output. My question is, can a person that has controll over the system running this program modify memory in such way that he modifies address space of variable CHECK and match it to number '1580' before IF condition is set and trigger IF function even if the algorithm didnt set '1580' in the first place?
protecting stack memory of program
137 Views Asked by TrueStar At
1
There are 1 best solutions below
Related Questions in SECURITY
- HTTPS configuration in Spring Boot, server returning timeout
- HSM ZKA control mask values
- OWASP Amass Subcommands
- Is there a need for BPF Linux namespace?
- Error when trying to execute a binary compiled in a Kali Linux machine on an Ubuntu system
- When sanitize/encode while implementing tags system like on SO
- spring security version in spring-boot-starter-security
- I am currently trying to implement a rudimentary firewall from a video I watched but the nimda worm detection is not working and i do not know why?
- Is it possible for `sudo` to fail temporarily with the correct password? Hacking suspected
- Is it viable proxying all my mobile apps requests, to some kind knowing that a request is coming from a secure source
- What abilities should I concentrate on while bug hunting, and how can I improve the quality of my bug bounty reports?
- System.ArgumentOutOfRangeException: I passed this error in every single program
- How to prevent users from creating custom client apps?
- Does server-side content security policy exist for youtube video player API, app, mod apks and website?
- Can we pass a hostname/IP address as a query string in a GET request in REST API
Related Questions in REVERSE-ENGINEERING
- How to find a sequence of bytes on the target program from my injected dll?
- Reversing and vtable swapping in dxgi.dll
- How to know Vector3 Position in Unity Mono Game
- Extracting an archive created via Java RandomAccessFile with PHP
- How can I verbosely track the whole process of calling a function?
- How can I patch a function call to a Windows DLL (e.g. kernel32 LoadLibrary)? Is this even possible?
- Grab SSL pinning certificate using Frida on iOS
- Kaitai Struct: error accessing elements in _parent
- How to restore damaged (mp3?) file
- CGSRegionRef: How is an arbitrary region represented as union of rects?
- can a convolutional neural network be reverse engineered?
- Decode suspected timestamps
- Extract Note Text Format (Bold/Italic/Strikethrough) from iOS OTG Backup
- Reverse engineer LCD Protocol used in MPC2000XL
- Opening a serial port using a prebuilt .so library
Related Questions in CODE-SECURITY
- Is obfuscation necessary for a .NET MAUI C# Android project when the library is compiled to native code in the format .dll.so?
- Does Docker need to be installed ona Windows server that's hosting a GitLab CICD runner?
- Is it possible to hide constant variable from browser dev tools in react js without using .env
- Getting some error while decrypting text in Java
- How can i get code safety on dart-flutter
- protecting stack memory of program
- What's the best way to enhance website security in inspect element?
- How to perform obfuscation of source code and protect source in electron js
- Prevent Headers dump through executable in cocoa osx app
- Save SQL Server Login savely in code (C#)
- C# - Get List of types that a source code file is using or refering to
- yii2 CSRF not working properly
- APPSACAN: Authentication.Credentials.Unprotected
- .NET framework : Are all System.* dlls not intellectual property?
- clang not stuck at #include "/dev/whatever"
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Yes, it's easy using a debugger, e.g. gdb. Set a breakpoint right before the
if, run the program until the breakpoint triggers, set the variable to any desired value, remove the breakpoint, and continue. You could even have the debugger skip the condition check altogether, jumping directly into the if-block. You could also replace the check in the binary code by anop. This is basically what "cracks" for pirating software do.Without the source code and debugging symbols this becomes somewhat harder as you have to figure out the addresses, but it just delays the inevitable. With complete access to the computer, you can manipulate any program any way you want. Various protection schemes exist (mainly obfuscation), but they just make it harder, not impossible.
To further prove my point, here is a very quick example: Given the following C code:
Compile it with optimizations and without symbols to make it a little harder, assuming an x86_64 linux system:
Ordinarily, this program would run for a few seconds before it quits. We want to make it quit immediately. Start it via the
gdbdebugger:Obtain information about memory ranges. We are interested in the start address of the
.textsection:So the actual code starts at
0x0000555555554610in memory. Let's disassemble some of it:That's the whole program. The
cmpinstruction is the interesting part; set a breakpoint there and let the program run:From the above assembly output you can see that
0x62c(i.e. 1580) is the magic number. Write it into the register, overwritingrand()s return value, and continue the program:The program will immediately print the message and quit. Had we used some kind of password-entry function instead of just
rand(), we could have done exactly the same thing to circumvent the password check. Instead of setting the value in the register, we could also have typedjump *0x000055555555463cto just jump into the if-block; that way, we don't even have to find the "magic" number.