+- +-

+-User

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+-Stats

Members
Total Members: 130
Latest: REEG
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 319
Total Topics: 160
Most Online Today: 2
Most Online Ever: 159
(June 29, 2021, 10:20:55 pm)
Users Online
Members: 0
Guests: 1
Total: 1

Author Topic: Writing shellcode in C++  (Read 1389 times)

squanchy

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Writing shellcode in C++
« on: October 17, 2016, 08:16:21 pm »
Some parts of the language generate position-independent code and others don't.

Safe stuff:
  • Functions
  • Classes
  • Templates
  • new/delete: the implementation of these can be overriden to make them use HealAlloc/HeapFree

Unsafe stuff:
  • String literals, global variables, static members of classes: in x86, the compiler hard-codes the adresses of these variables, so you have to create some kind of idiom (eg. delta offset) to access them. And still they are stored out of .text, so you have to work around that merging data sections into .text and giving it RWE attributes. In x64 references are relative to RIP so it's all good. For string literals there are a lot of options, one example is this.
  • Class hierarchies with virtual functions,C++ exceptions: the implementation of these is usually in stdlibc++, which means if you link with /nodefaultlib you can't use them

My two cents
Informative Informative x 2 View List

 

+-Recent Topics

Independent Call Girls in Chandigarh by dilpreetkaur
June 21, 2021, 01:02:52 pm

Hi zwclose7. How to create process by using NT apis? by zwclose7
June 01, 2021, 03:09:52 pm

Poison of the Day by zwclose7
March 16, 2020, 06:45:08 pm

IRC by AzeS
February 17, 2020, 08:18:01 am

Native API tutorial by hMihaiDavid
January 08, 2019, 02:11:02 am

The properties of GP nerve agent by xchg
October 19, 2018, 07:40:57 pm

A new route of synthesis for G-series agents by Basquyatti
October 15, 2018, 06:12:57 am

Synthesis of Methylisobutylcarbinylsarin (GH) by APC process by Basquyatti
October 14, 2018, 07:55:33 am

Synthesis conventional of Sarin by Basquyatti
October 02, 2018, 07:57:32 am

Reaction CX-7 (Experimental) by zwclose7
October 02, 2018, 12:46:47 am