@@ -934,6 +934,62 @@ def test_gpo__skips_unreadable_gpo_policies(client: Client, ad: AD, method: str)
934934 ), "Denied user authenticated successfully!"
935935
936936
937+ @pytest .mark .importance ("critical" )
938+ @pytest .mark .topology (KnownTopologyGroup .AnyAD )
939+ @pytest .mark .ticket (gh = 8896 )
940+ def test_gpo__rejects_path_traversal_in_gpo_file_sys_path (client : Client , provider : GenericADProvider ):
941+ """
942+ :title: Group policy object host based access control rejects path traversal in gPCFileSysPath
943+ :description:
944+ The gPCFileSysPath LDAP attribute of a GPO is parsed and used to build a local file system
945+ path under the SSSD GPO cache. A GPO with write access could append '..' path traversal
946+ gPCFileSysPath outside the cache directory. SSSD must reject such a policy rather than
947+ process it, and since the policy cannot be fetched, access must be denied in enforcing mode.
948+ :setup:
949+ 1. Create the following user, 'user1'
950+ 2. Create the GPO 'site policy' and add 'user1' and 'Domain Admins' to SeInteractiveLogonRight
951+ key
952+ 3. Read the GPO's real 'gPCFileSysPath' value and overwrite the attribute with the same
953+ path plus appended '..' path traversal components, then link the GPO
954+ 4. Configure sssd.conf with 'ad_gpo_access_control' = 'enforcing'
955+ 5. Start SSSD
956+ :steps:
957+ 1. Authenticate as 'user1'
958+ 2. Check logs for the path traversal rejection message
959+ :expectedresults:
960+ 1. 'user1' authentication is unsuccessful
961+ 2. The rejection message is present in the logs
962+ :customerscenario: False
963+ """
964+ user1 = provider .user ("user1" ).add ()
965+
966+ gpo = (
967+ provider .gpo ("site policy" )
968+ .add ()
969+ .policy (
970+ {
971+ "SeInteractiveLogonRight" : [user1 , provider .group ("Domain Admins" )],
972+ "SeDenyInteractiveLogonRight" : [],
973+ }
974+ )
975+ )
976+
977+ gpo_path = gpo .get ("gPCFileSysPath" )
978+ gpo .filesyspath (rf"{ gpo_path } \..\..\..\invalid" ).link ()
979+
980+ client .sssd .domain ["ad_gpo_access_control" ] = "enforcing"
981+ client .sssd .start ()
982+
983+ assert not client .auth .ssh .password (
984+ "user1" , password = "Secret123"
985+ ), "User authenticated successfully despite malicious GPO path traversal!"
986+
987+ log_str = client .fs .read (client .sssd .logs .domain ())
988+ assert (
989+ "gPCFileSysPath contains path traversal component" in log_str
990+ ), "Path traversal rejection message not found in logs!"
991+
992+
937993@pytest .mark .importance ("critical" )
938994@pytest .mark .parametrize ("method" , ["ssh" , "su" ])
939995@pytest .mark .topology (KnownTopologyGroup .AnyAD )
0 commit comments