impacket icon indicating copy to clipboard operation
impacket copied to clipboard

smbclient.py add SMB share permissions check (issues #186)

Open oladush opened this issue 6 months ago • 2 comments

This PR implements share permission checks as requested in #186.

Changes:

  • READ/WRITE/DELETE access check
  • New -check-access flag to verify share permissions
  • Supports -no-write-check to skip write/delete tests

Usage examples:

  1. Check specific shares:
    `python3 examples/smbclient.py 'test:[email protected]' -check-access 'MY SHARE, IPC$'`

  2. Check all available shares:
    `python3 examples/smbclient.py 'test:[email protected]' -check-access`

  3. Skip write/delete checks (read-only):
    `python3 examples/smbclient.py 'test:[email protected]' -check-access -no-write-check`

Fixes (https://github.com/fortra/impacket/issues/186)

oladush avatar Jun 22 '25 13:06 oladush

There exists a better way of enumerating share information: one can request a share information query for level 2 or 502 and the returned struct will also hold a permissions attribute.
This is a much better way to check privileges without manually testing each access possibility by uploading and modifying random files...
It is an important feature for sure but I would advise you implement it differently...

covertivy avatar Aug 01 '25 11:08 covertivy

Thanks for the feedback! I’ll check the documentation and rework the permissions check properly.

oladush avatar Aug 01 '25 12:08 oladush