About
Community
Bad Ideas
Drugs
Ego
Erotica
Fringe
Society
Technology
register | bbs | search | rss | faq | about
meet up | add to del.icio.us | digg it
Go Back   Community > Technology > Network (in)Security
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Network (in)Security Interesting hacks and cracks. Info on firewalls, TCP/IP, encryption, networks, and security. The ins and outs of the phone system, caller services, how things work, what's illegal and what's not, cellular phones, beepers, telephony legislation, the PUC, ISDN, taps, who's listening, and switches. Talking about phones, hacking systems, technical advice, and such is completely LEGAL in the United States -- it's covered by the First Amendment. What's illegal is conspiracy to commit a crime. So if you say something like "Meet me at 2am so we can crack a can" or "I changed my cell phone's number myself" you are criminally liable. Stating "You can crack a can by doing thus-and-so" or "If you wanted to change a cell phone's number, you could do it like so" is perfectly OK. Posting passwords, calling card numbers, or credit card numbers is forbidden on this network. Posting such info will get you booted off the net.

Reply
 
Thread Tools Display Modes
 #1 
Old 2004-12-24, 03:29
jamez jamez is offline
Regular
 
Default calling code from memory, C/C++

i was wondering, is there a way you can load compiled code into memory, and then run it that way? like making it into a char array, and then casting that into a function pointer or something?

reason is, a kickass polymorphic engine could be made from it.
 #2 
Old 2004-12-24, 03:33
cense cense is offline
Regular
 
Default Re: calling code from memory, C/C++

It's called shellcode.
 #3 
Old 2004-12-24, 06:58
lifejunkie lifejunkie is offline
Regular
 
Default Re: calling code from memory, C/C++

Yes, something like:

code:<pre>

char c[] = "\xf0\x0f\xc7\xc8";

int main(int argc, char **argv)

{

int (*func)();

func = (int (*)()) c;

(int)(*func)();

}

</pre>

Extra points for whoever can tell me what that code is for...



[This message has been edited by lifejunkie (edited 12-24-2004).]
 #4 
Old 2004-12-24, 09:36
borgel borgel is offline
Regular
 
Default Re: calling code from memory, C/C++

Pentium foof crash.

quote:Stolen quote

Basically, the opcodes are an invalid form of cmpxchg8b eax with a lock prefix. Has anyone seen this before? The problem doesn't show itself for the Pentium Pro or Pentium 2.
 #5 
Old 2004-12-25, 04:08
lifejunkie lifejunkie is offline
Regular
 
Default Re: calling code from memory, C/C++

Indeed.

Anyway, that's a basic way to get machine code into a .c file.
 #6 
Old 2004-12-27, 01:48
jamez jamez is offline
Regular
 
Default Re: calling code from memory, C/C++

ok, i have a few more questions.

1) is it possible to copy the code part of an exe file and make shellcode off that (really im asking is there any way an exe can be stored as shellcode)

2) how do you find and edit the strings that get compiled in a program? (i've been looking and all i can find are programs that edit the string table)

3) what limits does windows impose on antivirus (can it scan a programs memory)

4) how exactly does antivirus counter polymorphism?

5) how far do you have to go to make antivirus scan a file, like if a program makes a file, does it scan it instantly?
 #7 
Old 2004-12-27, 20:25
lifejunkie lifejunkie is offline
Regular
 
Default Re: calling code from memory, C/C++

quote:1) is it possible to copy the code part of an exe file and make shellcode off that (really im asking is there any way an exe can be stored as shellcode)

Shell code is used to get access to a machine. An .exe is a program. They are not related.

quote:

2) how do you find and edit the strings that get compiled in a program? (i've been looking and all i can find are programs that edit the string table)

Disassemble it.

quote:

3) what limits does windows impose on antivirus (can it scan a programs memory)

None, they have special device drivers to access memory and the hard drive directly.

quote:

4) how exactly does antivirus counter polymorphism?

Basically, they dont.

quote:

5) how far do you have to go to make antivirus scan a file, like if a program makes a file, does it scan it instantly?

Just navigate to the direcory that it's stored in.
 #8 
Old 2004-12-27, 23:14
blip blip is offline
Regular
 
Default Re: calling code from memory, C/C++

4) Heuristics can be used but due to their nature they can be expected to give false positives and negatives, the number of occurrences of each depending on the "sensitivity" set by the antivirus authors. Instead of or in addition to scanning for strings of signatures of virii, the AV program can stick the program in question in a kind of emulator and wait for any virus-like activities to take place. Activities are rated on whether they are virus-like or not and add or subtract to/from a kind of rating that says its a virus if it reaches a predetermined level (this level determining sensitivity). Things like getting keyboard input would detract from this rating and opening an executable for writing would certainly increase it by a large amount if not immediately warning the user. Other things that might not come immediately to mind that would increase the "likelihood tracker" would be using NOPs or instructions larger than are normally used (e.g. MOV AX,1234h as C7 C0 34 12 instead of B8 34 12). I remember reading two pdfs from Norton AV about countering polymorphic virii and another about their heuristics described though I don't remember the url. :-( Now they're all optimistic about this stuff, but it doesn't always work as it's intended. :-/

5) If it's set to scan upon execution, reading, or writing then it will do so. Also your av program may monitor program activities and warn you if a program is attempting to append itself to an executable or something. So in short, it depends on how the user setup their AV program. Remember that some people don't even use AV programs at all, though most do.
 #9 
Old 2004-12-28, 14:50
jamez jamez is offline
Regular
 
Default Re: calling code from memory, C/C++

thanks for the response,

i know shellcode is the wrong term, but i mean can it be run like shellcode is?
 #10 
Old 2004-12-29, 01:42
Regular
 
Default Re: calling code from memory, C/C++

hey jamez, has your nick ever been jamez226 or something like that?

also is your name James Parker?



[This message has been edited by Spliffing (edited 12-29-2004).]
 
To the best of our knowledge, the text on this page may be freely reproduced and distributed.
 

totse.com certificate signatures
 
 
About | Community | Bad Ideas | Drugs | Ego | Erotica | Fringe | Society | Technology
Hot Topics