[Full-disclosure] Permutation Oriented Programming
nbrito at sekure.org
Thu Jul 21 19:45:54 BST 2011
Many works have been done regarding evasion techniques against Intrusion Detection System (IDS) and Intrusion Prevention System (IPS), but most of them are related to:
- Packet fragmentation 
- Stream segmentation 
- Byte and traffic insertion 
- Polymorphic shellcode 
- Denial-of-Service 
- URL obfuscation (+ SSL encryption) 
- RPC fragmentation 
Permutation Oriented Programming (formerly known as Exploit Next Generation) introduces a different and powerful approach, which can be applied to almost all vulnerability, which targets the vulnerability trigger - so far none, or just few, research has been conducted addressing the vulnerability trigger.
To circumvent or avoid a pattern-matching detection approach, there are two options:
1. Easier (or Harder): know how the vulnerability is detected (access to signature/vaccine ).
2. Harder (or Easier): know deeply how to trigger the vulnerability and how to exploit it (access to vulnerable ecosystem).
Permutation Oriented Programming (also known as POP) is neither a new technique to obfuscate code nor a new technique to polymorphic shellcode, instead, it is a brand-new technique intended to change the behavior of exploit developers, and it provides a specific set of procedures for offering set based permutation of key aspects of an exploit to bypass, or perform quality assurance, ineffective IDS and IPS technologies:
- Pattern-matching signatures
- Stateful Packet Inspection
- Deep Packet Inspection
POP (pronounced /pŏp/) technique works by deep analysis of a vulnerability and using all the acquired knowledge of this analysis to offer a variety of decision points targeting the actual triggering of the vulnerability (i.e., brand-new variants), rather than the shellcode that executes after the vulnerability.
For POP technique to be effective, it requires exploit developers, as well as IDS and IPS developers, to determine additional paths to execution beyond those that are available in a standard exploit, or even in a standard proof-of-concept codes, including commercial automated penetration-test tools.
For POP technique to be effectively stopped, it requires that IDS and IPS developers understand the traits of the vulnerability equally well, and can detect multiple paths of execution. In essence, it shows the frailty of signature based IDS and IPS solutions. If they are simply based on pattern-matching signatures, they will not match the pattern after permutation, because they are skipping paths to execution and their signatures will fail on the permutation. Only IDS and IPS solutions that are robust will catch all of the permutation.
-=[ Last words
I have decided to change the name of this technique, because hackers and researchers have repulsion of the term "Next Generation"... Anyways, the technique is still the same and still is oriented to programming and knowledge.
The files, including PH-Neutral 0x7db  slide-deck and examples, are available at:
-=[ References & Credits
 "Insertion, Evasion, and Denial of Service: Eluding Network Intrusion Detection" by Thomas H. Ptacek and Timothy N. Newsham
 "DefCon 9: ADMmutate Polymorphic Shellcode API" by K2
 "A look at whisker's anti-IDS tactics" by Rain Forest Puppy
 "Black Hat USA: IPS Shortcomings" by Renaud Bidou
 "HTML obfuscation tool" by isnoop.net
 "Black Hat USA: A Simpler Way of Finding 0day" by Robert Graham and David Maynor
 PH-Neutral 0x7db by Phenoelit
"Intellectus excedit, praestat tacere."
8BD6 8CAD 41B7 19C5 EC04 C66D 70ED 23E4 E5AB 95EB
/* CIDR Calculator C Algorithm */
netmask = ~(0xffffffff >> cidr);
hostid = (1 << (32 - cidr)) - 2;
_1st_addr = (ntohl(addr) & netmask) + 1;
Full-Disclosure is hosted and sponsored by Secunia.