|
| 1 | +This module can be used to aid the generation of an organizational chart based on information |
| 2 | +contained in Active Directory. The module itself uses ADSI to retrieve key information from AD |
| 3 | +(manager, title, description etc) fields and then present it in a CSV file in the form: |
| 4 | + |
| 5 | +``` |
| 6 | +cn,description,title,phone,department,division,e-mail,company,reports_to |
| 7 | +``` |
| 8 | + |
| 9 | +The reports_to field is the only one which is generated; everything else is taken directly from AD. |
| 10 | +The 'manager' field contains the DN of the manager assigned to that user, and this module simply |
| 11 | +uses a regular expression to obtain the CN field of the manager. |
| 12 | + |
| 13 | +This can then be imported into tools like [Microsoft Visio](https://products.office.com/en-us/visio/flowchart-software) |
| 14 | +(using the organizational chart wizard) and it will construct a visual org chart from the |
| 15 | +information there. Although visio supports the ability to generate Org charts if it is on a domain |
| 16 | +joined machine, but there does not seem to be a way of doing this remotely (e.g. during a |
| 17 | +red teaming exercise). |
| 18 | + |
| 19 | +This should not be confused with security groups and AD managed groups; this is purely an |
| 20 | +internal organizational hierarchy representation but could be very useful for situational awareness |
| 21 | +or in order to construct a more plausible or targeted internal phishing exercise. |
| 22 | + |
| 23 | +# Options |
| 24 | + |
| 25 | +Option | Value |
| 26 | +-------------------| --- |
| 27 | +ACTIVE_USERS_ONLY | This will restrict the search for users to those whose accounts are Active. This would have the effect of excluding disabled accounts (e.g. employees who have resigned). |
| 28 | +FILTER | Any additional LDAP filtering that is required when searching for users. |
| 29 | +WITH_MANAGERS_ONLY | If this is TRUE, the module will only include users who have a manger set (internally, this is implemented by adding (manager=*) to the ADSI query filter). This could be useful if not everyone has a manager set, but could mean that the top executive is not included either. |
| 30 | +STORE_LOOT | Store the results in a CSV file in loot. You'll almost certainly want this set to TRUE. |
| 31 | + |
| 32 | +# Demo |
| 33 | + |
| 34 | +For the purposes of this contrived example, the module has been configured to generate the CSV |
| 35 | +reporting information for everyone with 'IT' somewhere in their common name. |
| 36 | + |
| 37 | +``` |
| 38 | +msf post(make_csv_orgchart) > show options |
| 39 | +
|
| 40 | +Module options (post/windows/gather/make_csv_orgchart): |
| 41 | +
|
| 42 | + Name Current Setting Required Description |
| 43 | + ---- --------------- -------- ----------- |
| 44 | + ACTIVE_USERS_ONLY true yes Only include active users (i.e. not disabled ones) |
| 45 | + DOMAIN no The domain to query or distinguished name (e.g. DC=test,DC=com) |
| 46 | + FILTER cn=*IT* no Additional LDAP filter to use when searching for users |
| 47 | + MAX_SEARCH 500 yes Maximum values to retrieve, 0 for all. |
| 48 | + SESSION 2 yes The session to run this module on. |
| 49 | + STORE_LOOT true yes Store the organisational chart information in CSV format in loot |
| 50 | + WITH_MANAGERS_ONLY false no Only users with managers |
| 51 | +
|
| 52 | +msf post(make_csv_orgchart) > run |
| 53 | +
|
| 54 | +Users & Managers |
| 55 | +================ |
| 56 | +
|
| 57 | + cn description title phone department division e-mail company reports_to |
| 58 | + -- ----------- ----- ----- ---------- -------- ------ ------- ---------- |
| 59 | + IT Manager Deputy GOAT IT Director [email protected] IT Director |
| 60 | + IT Director Director of Goat IT [email protected] |
| 61 | + IT Leader: Badger Team Leader of Blue Team Operations [email protected] IT Manager |
| 62 | + IT Leader: Otter Team Leader: Offensive Operations [email protected] IT Manager |
| 63 | + Oswold Otter (IT Team) Consultant [email protected] IT Leader: Otter |
| 64 | + Bertie Badger (IT Security Team) Default pass is badger123 IT Security Team Deputy [email protected] IT Leader: Badger |
| 65 | +
|
| 66 | +[*] CSV Organisational Chart Information saved to: /usr/home/s/stuart/.msf4/loot/20151221175733_stufusdev_192.0.2.140_ad.orgchart_189769.txt |
| 67 | +[*] Post module execution completed |
| 68 | +``` |
| 69 | + |
| 70 | +The contents of the CSV file are shown below: |
| 71 | + |
| 72 | +``` |
| 73 | +$ cat /usr/home/s/stuart/.msf4/loot/20151221175733_stufusdev_192.0.2.140_ad.orgchart_189769.txt |
| 74 | +cn,description,title,phone,department,division,e-mail,company,reports_to |
| 75 | +"IT Manager","","Deputy GOAT IT Director","","","","[email protected]","","IT Director" |
| 76 | +"IT Director","","Director of Goat IT","","","","[email protected]","","" |
| 77 | +"IT Leader: Badger","","Team Leader of Blue Team Operations","","","","[email protected]","","IT Manager" |
| 78 | +"IT Leader: Otter","","Team Leader: Offensive Operations","","","","[email protected]","","IT Manager" |
| 79 | +"Oswold Otter (IT Team)","","Consultant","","","","[email protected]","","IT Leader: Otter" |
| 80 | +"Bertie Badger (IT Security Team)","Default pass is badger123","IT Security Team Deputy","","","","[email protected]","","IT Leader: Badger" |
| 81 | +``` |
| 82 | + |
| 83 | +When this was imported into Visio with default options set, it produced the following organisational chart: |
| 84 | + |
| 85 | + |
0 commit comments