OneDrive用户枚举 - 渗透测试工具,用于枚举有效的O365用户

作者:Sec-Labs | 发布时间:

项目地址

https://github.com/nyxgeek/onedrive_user_enum

项目用途

该项目旨在通过枚举OneDrive用户来发现有效的OneDrive用户,可以实现以下功能:

  • 使用本地数据库(sqlite3)
  • 自动查找租户
  • 读取文件夹中的文件
  • 可以快速创建“jsmith1”、“jsmith2”等用户名
  • 去重功能,可以删除以前尝试过的用户名
  • 在“x”次尝试后自动取消用户名列表

相关技术点

  • OneDrive用户具有已知位置的文件共享URL。
  • 如果用户已经登录到OneDrive,则该路径将存在并返回403状态代码。
  • 如果他们没有登录,或者用户无效,则将返回404.
  • 该方法更加被动,不会尝试登录,因此更加难以被检测到。

onedrive_user_enum v2.00

枚举有效的OneDrive用户

有关枚举技术和OneDrive枚举的完整概述,请查看此处的博客:

https://www.trustedsec.com/blog/onedrive-to-enum-them-all/

现在新增了以下功能:

  • 本地数据库(sqlite3)
  • 租户自动查找(感谢@DrAzureAD和@thetechr0mancer)
  • 读取文件或文件夹中的文件
  • 追加 -- 轻松创建'jsmith1' 'jsmith2'等用户名
  • 跳过已尝试的用户名 -- 删除先前尝试过的用户名
  • 取消用户列表 -- 如果在“x”次尝试中没有识别出用户名,则取消用户列表

OneDrive枚举概述:

OneDrive用户具有已知位置的文件共享URL:

https://acmecomputercompany-my.sharepoint.com/personal/lightmand_acmecomputercompany_com/_layouts/15/onedrive.aspx

在这种情况下,用户名为'lightmand',域名为'acmecomputercompany.com'。如果用户已登录OneDrive,则此路径将存在并返回403状态代码。如果他们没有登录,或者用户无效,则会返回404。

结果可能因组织内OneDrive的使用广泛程度而异。目前,这是我所知道的最可靠的用户枚举方法(office365userenum不再起作用,其他像UhOh365这样的方法不可靠)。此外,它不会尝试登录,更加被动,并且应该对目标组织不可检测。微软将看到点击数,但目标组织不会。

用法

# ./onedrive_enum.py -h

*********************************************************************************************************

                                         ██████               ███                          
                                        ░░████               ░░░                           
   ██████    █████████     ███████    ████████   █████████   ████   █████  █████   ███████ 
  ███░░███  ░░███░░░███   ███░░░███  ███░░░███  ░░███░░░███ ░░███  ░░███  ░░███   ███░░░███
 ░███  ░███  ░███  ░███  ░████████  ░███ ░░███   ░███  ░░░   ░███   ░███   ░███  ░████████ 
 ░███  ░███  ░███  ░███  ░███░░░░   ░███ ░░███   ░███        ░███   ░░███  ███   ░███░░░   
 ░░██████    ████  █████ ░░███████  ░░█████████  ██████      █████   ░░██████    ░░███████ 
  ░░░░░░    ░░░░  ░░░░░   ░░░░░░░    ░░░░░░░░░  ░░░░░░      ░░░░░     ░░░░░░      ░░░░░░░  
                                                                             
                                                                             
   ██████  ████████   █████ ████ █████████████      +-------------------------------------------------+
  ███░░███░░███░░███ ░░███ ░███ ░░███░░███░░███     |               OneDrive Enumerator               |
 ░███████  ░███ ░███  ░███ ░███  ░███ ░███ ░███     |           2023 @nyxgeek - TrustedSec            |
 ░███░░░   ░███ ░███  ░███ ░███  ░███ ░███ ░███     |                 version 2.00                    |
 ░░██████  ████ █████ ░░████████ █████░███ █████    |  https://github.com/nyxgeek/onedrive_user_enum  |
  ░░░░░░  ░░░░ ░░░░░   ░░░░░░░░ ░░░░░ ░░░ ░░░░░     +-------------------------------------------------+
                                                                             
*********************************************************************************************************
usage: onedrive_enum.py [-h] -d  [-t] [-u] [-a] [-U] [-p] [-o] [-T] [-e] [-r] [-x] [-n] [-k] [-v]

options:
  -h, --help           show this help message and exit
  -d , --domain        target domain name (required)
  -t , --tenant        tenant name
  -u , --username      user to target
  -a , --append        mutator: append a number, character, or string to a username
  -U , --userfile      file containing usernames (wordlists) -- will also take a directory
  -p , --playlist      file containing list of paths to user lists (wordlists) to try
  -o , --output        file to write output to (default: output.log)
  -T , --threads       total number of threads (defaut: 100)
  -e , --environment   Azure environment to target [commercial (default), chinese, gov]
  -r, --rerun          force re-run of previously tested tenant/domain/wordlist combination
  -x, --skip-tried     dedupe. skip any usernames from previous runs
  -n, --no-db          disable logging to db
  -k , --killafter     kill off non-productive jobs after x tries with no success
  -v, --verbose        enable verbose output

示例

# ./onedrive_enum.py -t microsoft -d microsoft.com -U USERNAMES/statistically-likely/jsmith.txt

*********************************************************************************************************

                                         ██████               ███                          
                                        ░░████               ░░░                           
   ██████    █████████     ███████    ████████   █████████   ████   █████  █████   ███████ 
  ███░░███  ░░███░░░███   ███░░░███  ███░░░███  ░░███░░░███ ░░███  ░░███  ░░███   ███░░░███
 ░███  ░███  ░███  ░███  ░████████  ░███ ░░███   ░███  ░░░   ░███   ░███   ░███  ░████████ 
 ░███  ░███  ░███  ░███  ░███░░░░   ░███ ░░███   ░███        ░███   ░░███  ███   ░███░░░   
 ░░██████    ████  █████ ░░███████  ░░█████████  ██████      █████   ░░██████    ░░███████ 
  ░░░░░░    ░░░░  ░░░░░   ░░░░░░░    ░░░░░░░░░  ░░░░░░      ░░░░░     ░░░░░░      ░░░░░░░  
                                                                             
                                                                             
   ██████  ████████   █████ ████ █████████████      +-------------------------------------------------+
  ███░░███░░███░░███ ░░███ ░███ ░░███░░███░░███     |               OneDrive Enumerator               |
 ░███████  ░███ ░███  ░███ ░███  ░███ ░███ ░███     |           2023 @nyxgeek - TrustedSec            |
 ░███░░░   ░███ ░███  ░███ ░███  ░███ ░███ ░███     |                 version 2.00                    |
 ░░██████  ████ █████ ░░████████ █████░███ █████    |  https://github.com/nyxgeek/onedrive_user_enum  |
  ░░░░░░  ░░░░ ░░░░░   ░░░░░░░░ ░░░░░ ░░░ ░░░░░     +-------------------------------------------------+
                                                                             
*********************************************************************************************************

Beginning enumeration of https://microsoft-my.sharepoint.com/personal/USER_microsoft_com/
--------------------------------------------------------------------------------------------------------
[-] [403] VALID USERNAME FOR microsoft,microsoft.com - user1, username:user1@microsoft.com
[-] [403] VALID USERNAME FOR microsoft,microsoft.com - user2, username:user2@microsoft.com
[-] [403] VALID USERNAME FOR microsoft,microsoft.com - user3, username:user3@microsoft.com

注意:有效但尚未登录 OneDrive 的用户将返回404未找到。

致谢:感谢 @DrAzureAD、@thetechr0mancer、@rootsecdev、@hacking_lz。

标签:工具分享