News for hackers. Stuff that matters.
Re:Bypassing Antivirus with Ten Lines of Code by Uptrenda on Sunday March 20, 2016 @07:13PM (#11325163)
So what's this line all about:

((void(*)())exec)();

Type cast a void pointer to a void pointer, execute the result, then execute the result of that? Or ... Can anyone explain what's going on here?

Re:Bypassing Antivirus with Ten Lines of Code by kondbg on Sunday March 20, 2016 @07:22PM (#11325196)
This is a common way of executing shellcode in a PoC.

Exec (before the cast) points to memory containing the shellcode data.

To actually start executing the shellcode, you just need to somehow cause the program counter to point to the address of the shellcode.

An easy way to change the program counter is by calling a function ... which is what this line does.

Read this as "cast exec to a pointer to a function that takes zero arguments and returns void and call the function with no arguments."

This is the same as:

   typedef void (*some_func)();
   some_func func = (some_func)exec;
   func();
To familiarize yourself with C syntax regarding pointers, read about the "right-left rule" [1]

[1] http://ieng9.ucsd.edu/~cs30x/rt_lt.rule.html

Re:Bypassing Antivirus with Ten Lines of Code by Uptrenda on Sunday March 20, 2016 @08:04PM (#11325332)
This is insanely clever. Thanks a lot for the explanation
Re:Bypassing Antivirus with Ten Lines of Code by sz4kerto on Sunday March 20, 2016 @07:16PM (#11325173)
Without reading the article: it looks like it casts exec to a function pointer with void return type and no arguments, and calls it. (Disclaimer: I'm paid for writing Java :( )
Re:Bypassing Antivirus with Ten Lines of Code by reginaldo on Sunday March 20, 2016 @07:20PM (#11325191)
Almost. It's casting exec to a pointer to a function that "returns" void and takes no arguments and then calling the function. Search for "C right-left rule" (without quotes) to see some hints on how to read complex declarations (mostly applies to casting too). I like http://ieng9.ucsd.edu/~cs30x/rt_lt.rule.html
Re:Bypassing Antivirus with Ten Lines of Code by frede on Sunday March 20, 2016 @07:21PM (#11325192)
It's actually a cast to a function pointer with signature: void exec(). The trailing brackets () then make the program call the function.