public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: SMBFS mount's file cannot be made executable
Date: Wed, 13 Nov 2024 18:17:55 +0900	[thread overview]
Message-ID: <20241113181755.02289e8e8d9af7e19e8f4387@nifty.ne.jp> (raw)
In-Reply-To: <ZzNCXz3o9k40U9zA@calimero.vinschen.de>

Hi Corinna,

On Tue, 12 Nov 2024 12:56:15 +0100
Corinna Vinschen wrote:
> On Nov 12 17:54, Takashi Yano via Cygwin wrote:
> > I noticed that the probelm is not only in samba share, but
> > also in Windows share.
> > 
> > Yesterday, I used shared resource of the root directory.
> > In that case, access right of Authenticated Users was enabled.
> > However, when I tried resource under the user folder, the access
> > right of Authenticated Users is not assigned as follows.
> > 
> > $ icacls '\\kappy3\Share\smb_shared_file.txt'
> > \\kappy3\Share\smb_shared_file.txt NULL SID:(DENY)(Rc,S,X,DC)
> >                                    S-1-5-21-2089672436-4097686843-2104605006-1001:(R,W,D,WDAC,WO)
> >                                    NT AUTHORITY\SYSTEM:(DENY)(S,X)
> >                                    BUILTIN\Administrators:(DENY)(S,X)
> >                                    S-1-5-21-2089672436-4097686843-2104605006-513:(R)
> >                                    NT AUTHORITY\SYSTEM:(RX,W)
> >                                    BUILTIN\Administrators:(RX,W)
> >                                    Everyone:(R)
> > 
> > Successfully processed 1 files; Failed processing 0 files
> > 
> > $ ls -l //kappy3/Share/smb_shared_file.txt
> > -rw-r--r--+ 1 Unknown+User Unknown+Group 0 11月 12 15:50 //kappy3/Share/smb_shared_file.txt
> > 
> > $ /cygdrive/c/Windows/system32/whoami /USER
> > 
> > USER INFORMATION
> > ----------------
> > 
> > User Name    SID
> > ============ ==============================================
> > hp-z230\yano S-1-5-21-1515853178-1880514851-1804962447-1001
> > 
> > 
> > The file server is not in AD and uses offline account in Windows 11
> > (means no Microsoft Account). The client also uses offline account
> > in Windows 10 too.
> > The server and the client use the same user name and password, so
> > authentication is automatically done.
> 
> It's not *that* automatic.  Your user SIDs are still different on
> all standalone machines, so they are still different accounts, SID-wise.
> 
> > In this case, access() of the current cygwin wrongly refers to the
> > permissions for 'others'.
> > 
> > I wonder why the NtAccessCheck() can not handle this situation
> > correctly.
> 
> I really can't tell you, but there's
> https://learn.microsoft.com/en-us/windows/win32/secauthz/how-dacls-control-access-to-an-object
> So, apparently, NtAccessCheck only checks the DACL against the
> SID list in the user token.  In the above case, the ACL does not
> contain your user account, nor one of the groups you're member
> of.  So your account's access is the one for the Everyone entry.
> 
> > The process token does not have the privilege of the
> > SIDs in the server side even though the authentication has been
> > done by 'net use' command?
> 
> This is one of things puzzeling me for a while.  As soon as you
> authenticate to some standalone server for SMB, your access token should
> additionally contain the SID of the server account you authenticated as,
> at least for file access.  But that's not the case.
> 
> I just stumbled over
> https://learn.microsoft.com/en-us/troubleshoot/windows-server/windows-security/access-checks-windows-apis-return-incorrect-results
> 
> It seems to suggest to use AuthZ in a certain way to check permissions.
> Maybe we can replace NtAccessCheck with AuthZ?  If we're lucky, we might
> even get away with the already existing code in the authz_ctx class
> defined in sec/helper.cc.  If not, we may have to add another function
> method calling AuthzInitializeRemoteResourceManager instead of
> AuthzInitializeResourceManager.
> 
> Care to hack up a test?

I'm working on this, however, I stuck on setting the first parameter
of AuthzInitializeRemoteResourceManager(). The most members of structure
AUTHZ_RPC_INIT_INFO_CLIENT are PWSTR, and I have no idea what kind of
string should be set to each member. Especially Endpoint and ServerSpn.

typedef struct _AUTHZ_RPC_INIT_INFO_CLIENT {
  USHORT version;
  PWSTR  ObjectUuid;
  PWSTR  ProtSeq;
  PWSTR  NetworkAddr;
  PWSTR  Endpoint;
  PWSTR  Options;
  PWSTR  ServerSpn;
} AUTHZ_RPC_INIT_INFO_CLIENT, *PAUTHZ_RPC_INIT_INFO_CLIENT;

Do you have any idea?

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

  reply	other threads:[~2024-11-13  9:17 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 15:42 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2024-11-08 11:51 ` Takashi Yano
2024-11-08 13:11   ` Corinna Vinschen
2024-11-11 10:31     ` Takashi Yano
2024-11-11 10:31       ` Takashi Yano via Cygwin
2024-11-11 10:56       ` Corinna Vinschen
2024-11-11 10:56         ` Corinna Vinschen via Cygwin
2024-11-11 11:19         ` Takashi Yano
2024-11-11 11:19           ` Takashi Yano via Cygwin
2024-11-11 11:32           ` Takashi Yano
2024-11-11 11:32             ` Takashi Yano via Cygwin
2024-11-11 11:40             ` Takashi Yano
2024-11-11 11:40               ` Takashi Yano via Cygwin
2024-11-11 12:03               ` Corinna Vinschen
2024-11-11 12:03                 ` Corinna Vinschen via Cygwin
2024-11-11 12:19                 ` Takashi Yano
2024-11-11 12:19                   ` Takashi Yano via Cygwin
2024-11-11 13:35                   ` Corinna Vinschen
2024-11-11 13:35                     ` Corinna Vinschen via Cygwin
2024-11-11 19:29                     ` Takashi Yano
2024-11-11 19:29                       ` Takashi Yano via Cygwin
2024-11-12  8:54                       ` Takashi Yano
2024-11-12 11:56                         ` Corinna Vinschen
2024-11-13  9:17                           ` Takashi Yano [this message]
2024-11-13 15:10                             ` Bill Stewart
2024-11-13 15:37                               ` Takashi Yano
2024-11-13 15:58                                 ` Bill Stewart
2024-11-13 16:08                                   ` Takashi Yano
2024-11-15 15:21                                     ` Takashi Yano
2024-11-18 16:26                                       ` Corinna Vinschen
2024-11-19  8:58                                         ` Takashi Yano
2024-11-19 20:54                                           ` Corinna Vinschen
2024-12-07 23:13                                             ` Takashi Yano
2024-12-08  7:57                                               ` Takashi Yano
2024-12-09 11:11                                               ` Corinna Vinschen
2024-11-12 11:31                       ` Corinna Vinschen
2024-11-11 11:51           ` Takashi Yano
2024-11-11 11:51             ` Takashi Yano via Cygwin
2024-11-11 11:59           ` Corinna Vinschen
2024-11-11 11:59             ` Corinna Vinschen via Cygwin
2024-11-11 12:25             ` Takashi Yano
2024-11-11 12:25               ` Takashi Yano via Cygwin
2024-11-11 13:00             ` Takashi Yano
2024-11-11 13:00               ` Takashi Yano via Cygwin
2024-11-11 13:18               ` Corinna Vinschen
2024-11-11 13:18                 ` Corinna Vinschen via Cygwin
2024-11-08 16:07   ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2024-11-11  9:04     ` Takashi Yano
2024-11-11  9:04       ` Takashi Yano via Cygwin
2019-08-12 19:05 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-13  8:28 ` KAVALAGIOS Panagiotis (EEAS-EXT)
     [not found] ` <704986a5a4ab41709eb963dcd23887b1@BELBRU-EXMP101.eeas.europa.eu>
2019-08-13 12:27   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-13 18:34     ` Achim Gratz
2019-08-13 18:35     ` Andrey Repin
2019-08-13 23:19       ` Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-14 20:05         ` Andrey Repin
2019-08-14  0:53 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-14  2:36 ` Ken Brown
2019-08-14 16:59 ` Achim Gratz
2019-08-14  4:24 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-14 11:22 ` Ken Brown
2019-08-14 22:58   ` Brian Inglis
2019-08-14 14:07 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-15  1:28 ` Ken Brown
2019-08-14 20:39 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-15  1:31 ` Ken Brown
2019-08-15  1:40 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-15  2:59 ` Brian Inglis
2019-08-15  2:00 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-15  9:21 ` L A Walsh
2019-08-15  9:23 ` L A Walsh
2019-08-21  7:12   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241113181755.02289e8e8d9af7e19e8f4387@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).