#ifndef NALL_PUBLIC_CAST_HPP #define NALL_PUBLIC_CAST_HPP //this is a proof-of-concept-*only* C++ access-privilege elevation exploit. //this code is 100% legal C++, per C++98 section 14.7.2 paragraph 8: //"access checking rules do not apply to names in explicit instantiations." //usage example: //struct N { typedef void (Class::*)(); }; //template class public_cast; //(class.*public_cast::value); //Class::Reference may be public, protected or private //Class::Reference may be a function, object or variable namespace nall { template struct public_cast; template struct public_cast { static typename T::type value; }; template typename T::type public_cast::value; template struct public_cast { static typename T::type value; }; template typename T::type public_cast::value = public_cast::value = P; } #endif