-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SMB] Massive Fixes, Features and Refactoring #1894
base: master
Are you sure you want to change the base?
Conversation
…lags. Then sort out some mismatching flags.
…, write and delete. I found it out when capturing network traffic and seeing I can manage to read files with open handles. This fixes SHARE_ACCESS_DENIED errors when trying to read files with handles on them. This is the logical thing to do when we open files for reading. We do not want to block other processes from interacting with the file. This may raise problems when reading files that are being written into / being deleted. I still think this is the right move since we usually want to read the files no matter what.
This is related to my older commits on the subject.
Add method parameters to `getFile` to easily communicate with the underlying SMB API.
We obviously do not want to allow others to write to the file while we are writing to it.
…n` values in SMBv2.
Really important fix that makes SMB more intuitive! Please merge! |
Hello, interesting PR, however, it does not seem to be working on my side, am I missing something?
|
The problem is with your test case. I am happy to help with any other questions you may have 😊 |
This is done to assist future development of SetInfo operations on files and directories. ``` Date Conversion Example - Year Component: ----------------------------------------- 2009 - 1980 = 29 | (convert to binary) V 0001 1101 | (position data correctly by shifting) V 0001 1101 << 9 --------------------- = 0 0011 1010 0000 0000 | (trim to correct size with bitwise AND of correct mask) V 0 0011 1010 0000 0000 & 1111 1110 0000 0000 --------------------- = 0011 1010 0000 0000 ```
By doing so I also fixed a bad structure definition in the SMBSetFileBasicInfo structure. Now we can modify file information remotely ;)
Also converted the SMB DATETIME methods to use my SMB_DATE and SMB_TIME implementations.
Also implemented setInfo method to use for setting file information.
fileInformationClasses other than the default one.
…s using SMB. for now only implemented query.
Hi again, I am changing the title because this is slowly growing into something much bigger. I will soon add a better description and list all of the current changes I have made to the SMB libraries but the work is far from over 😅 Changes done so far:
I believe that is all for now, I will make sure to keep you posted! Have a good one 😉 |
Hello!
I did some research regarding some annoying
STATUS_SHARING_VIOLATION
andSTATUS_ACCESS_DENIED
errors.I know for a fact that some files that cannot be read with
smbclient
can be copied aside with a command / the file explorer.This means that theoretically it should be possible to do so over SMB!
I opened up Wireshark and played around a bit - it seems this is caused by over-restrictive share access permissions on
impacket
's side.I then dug deeper and saw some mismatching flag usage in the SMBv1 implementation of the protocol so I fixed those too.
To sum up, I added the ability to READ FILES WITH OPEN HANDLES WITH (ALMOST) NO RESTRICTION!!!
The only restriction is of course for some system files (eg.
SAM
,SECURITY
,SYSTEM
and basically all files that require aShadowCopy
to allow reading them).This means that files with "weak handles" can be read remotely WITH ABSOLUTELY NO LIMITATION!
The list contains:
*.evt
/*.evtx
Glad to suffer for all y'alls pleasure!