Bash script to recursively check for writable directories within an SMB share by attempting to upload a test file to each directory found. Writable directories are highlighted in green for easy identification.
- Recursively lists directories in an SMB share.
- Attempts to upload a test file to check for write access.
- Highlights writable directories in green for easy visibility.
smbclient
from the Samba suite.
-
Clone this repository:
git clone https://github.com/808ale/smb_write_checker.git cd smb_write_checker
-
Ensure
smbclient
is installed on your system:-
On Ubuntu/Debian:
sudo apt install smbclient
-
On CentOS/RHEL:
sudo yum install samba-client
-
-
Make the script executable:
chmod +x smb_write_checker.sh
Run the script with the following arguments:
./smb_write_checker.sh -t <target> -s <share> -u <username> -p <password>
-t
Target: The SMB server address (e.g.,sizzle.htb.local
).-s
Share: The name of the SMB share to scan (e.g.,Department Shares
).-u
Username: The username for SMB authentication.-p
Password: The password for the provided username (can be empty if no password is required).
./smb_write_checker.sh -t sizzle.htb.local -s "Department Shares" -u guest -p ""
-
The script will print a list of directories being tested.
-
Writable directories will be highlighted in green with the message:
[+] Writable: /path/to/directory
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is intended for educational purposes only. Ensure you have permission to test any SMB shares you are scanning.