27.10.2014 Views

Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions

Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions

Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Solutions</strong> to Chapter 16 | Low Level<br />

16.7 What are <strong>the</strong> best practices to prevent reverse engineering of DLLs?<br />

SOLUTION<br />

pg 82<br />

Best practices include <strong>the</strong> following:<br />

»»<br />

Use obfuscators.<br />

»»<br />

Do not store any data (string, etc) in open form. Always compress or encode it.<br />

»»<br />

Use a static link so <strong>the</strong>re is no DLL to attack.<br />

»»<br />

Strip all symbols.<br />

»»<br />

Use a .DEF file <strong>and</strong> an import library to have anonymous exports known only by <strong>the</strong>ir<br />

export ids.<br />

»»<br />

Keep <strong>the</strong> DLL in a resource <strong>and</strong> expose it in <strong>the</strong> file system (under a suitably obscure<br />

name, perhaps even generated at run time) only when running.<br />

»»<br />

Hide all real functions behind a factory method that exchanges a secret (better, proof of<br />

knowledge of a secret) for a table of function pointers to <strong>the</strong> real methods.<br />

»»<br />

Use anti-debugging techniques borrowed from <strong>the</strong> malware world to prevent reverse<br />

engineering. (Note that this will likely get you false positives from AV tools.)<br />

»»<br />

Use protectors.<br />

CareerCup.com<br />

2 4 4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!