140 likes | 237 Vues
Sung Kim from MIT explores the use of binary variable learning in detecting and preventing Apache exploits. The study includes implementing preliminary binary variable learning, generating valid invariants, and applying BVL to Apache exploits. The study also demonstrates how a manual patch can prevent these exploits effectively.
E N D
Binary Variable Learner and Apache exploits Sung Kim MIT
Apache Exploits http://localhost/re/ldap://local/dn?attributes?scope?filter?extenslsions http://localhost/re/ldap://local/dn?attributes?scope?filter?extenslsions?ext
Apache Exploits http://.../ldap://local/dn?attributes?scope?filter?extenslsions?ext Apache 2.0.58 or earlier static char * escape_absolute_uri(char *, unsigned int) { … if (!strncasecmp(uri, "ldap", 4)) { int c = 0; char *token[5]; token[0] = cp = apr_pstrdup(p, cp); while (*cp && c < 5) { if (*cp == '?') { token[++c] = cp + 1; *cp = '\0'; } ++cp; }
Apache Exploits if (!strncasecmp(uri, "ldap", 4)) { int c = 0; char *token[5]; token[0] = cp = apr_pstrdup(p, cp); while (*cp && c < 5) { if (*cp == '?') { token[++c] = cp + 1; *cp = '\0'; } ++cp; }
Apache Exploits if (!strncasecmp(uri, "ldap", 4)) { int c = 0; char *token[5]; token[0] = cp = apr_pstrdup(p, cp); while (*cp && c < 5) { if (*cp == '?') { token[++c] = cp + 1; *cp = '\0'; } ++cp; } token[5] = cp + 1;
Binary Variable if (!strncasecmp(uri, "ldap", 4)) { int c = 0; char *token[5]; token[0] = cp = apr_pstrdup(p, cp); while (*cp && c < 5) { if (*cp == '?') { token[++c] = cp + 1; *cp = '\0'; } ++cp; } loop: jge end_loop mov ecx,dword ptr [ebp-18h] mov dword ptr [ebp+ecx*4-14h], eax jmp loopend_loop: push offset buf_over! (00409a38)
Binary Variable loop: jgeend_loop movecx,dwordptr [ebp-18h]movdwordptr [ebp+ecx*4-14h], eaxjmp loopend_loop: push offset buf_over! (00409a38) token[++c] = cp + 1;
Binary Variable loop: jgeend_loop movecx,dwordptr [ebp-18h]movdwordptr [ebp+ecx*4-14h], eaxjmp loopend_loop: push offset buf_over! (00409a38) token[++c] = cp + 1; movdwordptr [ebp+ecx*4-14h], eax
Binary Variable movdwordptr [ebp+ecx*4-14h], eax Base Offset Source Index
Binary Variable push 14h ; variable name push ebp; variable name push ecx; variable value call write_binary_variable movdwordptr [ebp+ecx*4-14h], eax
Community Learning User User User …… Apache Apache Apache Invariants Invariants Invariants CMS ..escape_absolute_uri(char *, unsigned int):::ENTER_4010A5binary_var <= 4 binary_var>= 1
Patch (Manual) !(ecx <= 4) then jmp skip movdwordptr [ebp+ecx*4-14h], eax skip:
Conclusions • Implemented preliminary binary variable learning (BVL) • Generated valid invariants • Applied BVL to Apache and its exploits • Showed the(manual) patch can prevent the exploit
Binary Variable Learner and Apache exploits Sung Kim MIT