Computing.Net > Forums > Programming > load into memory ?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

load into memory ?

Reply to Message Icon

Name: S
Date: July 22, 2002 at 17:31:42 Pacific
Comment:

Hi,

an compiled executable program need to be loaded into memory before it is executed. what does it mean by "load into memory" ?
does it load (put a copy) of the instructions (instruction 1, instruction 2,...) into the RAM ?

if am right than suppose i have the following C program:

int main ()
{
int password;

printf("Enter password : ");
scanf("%d", &password);

if (password != 1234)
exit (0);
else
printf("do this....");

return 0;
}


in this case, i don't have to run through "enter password" before reaching "do this",
because i can insert a jmp command and jump directly to the address of "do this". am i right? any correction would be grateful.

ps i am not on purpose to hack any password, i just curious about this.



Sponsored Link
Ads by Google

Response Number 1
Name: hmm
Date: July 22, 2002 at 21:06:05 Pacific
Reply:

Programs are loaded into memory before they are run. Otherwise, programs wouldn't need to state memory requirements (they would just be able to swap bits and pieces into what little memory you had).

You have to understand that computers are dumb. They only understand ON and OFF. 0's and 1's. Humans can't understand it (well, unless you were one of the pioneers with the first "computers"). When you write a program in a high-level language, like C, it is "translated" into machine language. A program in machine language (ie: assembly language), is completely loaded into memory. It has instructions such as load this data into that register, or jump to this memory location. Jumping from one memory to another is common place. But in order for it to work, the whole program needs to be in memory so that the computer knows exactly where to jump.

Usually operating systems protect processes/programs from being able to invade the memory space of other processes. You will get an invalid memory range error.

One way to do what you want would be to see if the code has a vulnerability. Perhaps you can overload a buffer and have the program overwrite itself (there are programs that are like this...microsoft programs, for example)


0

Response Number 2
Name: Jim
Date: July 22, 2002 at 22:17:38 Pacific
Reply:

You are exactly correct. The instructions are copied into memory in the order they were in the executable file on the disk. You can bypass the password check either by changing the data in the file, or by changing the memory after it is loaded. Of course first you need to find exactly where the code is in the file or in memory. That will take either a debugger/disassembler or some pretty good knowledge of how it translates into machine code. You're not likely going to see "if (password != 1234)" in the executable anywhere.

Some password checks are that simple, and are circumvented that easily. However, most engineers make it a little bit harder to bypass their protection. Heck, if you can find that code to modify it, why didn't you just notice that it was comparing with 1234? That way, you could just type in 1234 and you wouldn't have to change the code at all.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: load into memory ?

reading memory locations www.computing.net/answers/programming/reading-memory-locations/6293.html

batch problem www.computing.net/answers/programming/batch-problem-/11835.html

passing parameters (assembly) www.computing.net/answers/programming/passing-parameters-assembly/14119.html