Exploit databaseDownload repository ZIP
GH-88d8bc551618926a04536090300b4292
dungnm24/cve-2020-0796
Sources for CVE-2020-0796
81 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files29
dungnm24/cve-2020-0796Revision fe7aebbe1789
- ↑..Parent directory
- ConsistencyRules.cs
- ConstructedAttributes.cs
- Cross-RefContainer.cs
- DRSRRequirement.cs
- DomainUpdatesContainer.cs
- ExtendedRights.cs
- ForestUpdatesContainer.cs
- FunctionalLevel.cs
- IsSingleValued.cs
- LDSRoleContainer.cs
- MS-ADTS-Schema_ServerTestSuite.cs
- NCRename.cs
- OptionalFeature.cs
- QueryNC.cs
- ReadOnlyDomainController.cs
- SchemaAttributes.cs
- SchemaClasses.cs
- SchemaInternalConsistency.cs
- SchemaModification.cs
- ServerContainer.cs
- ServiceAndQueryPolicyContainer.cs
- SiteContainer.cs
- Syntaxes.cs
- SystemOnly.cs
- UniqueID.cs
- Utility.cs
- WellKnowObjects.cs
- WellKnownSecurityDomainPrincipal.cs
- WellKnownSecurityPrincipal.cs
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
WindowsProtocolTestSuites/TestSuites/ADFamily/src/TestSuite/MS-ADTS-Schema/WellKnownSecurityPrincipal.cs
C# · 26,358 bytes// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;
using System.IO;
using System.Security.Principal;
using System.Text;
using Microsoft.Protocols.TestTools;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.Protocol.TestSuites.ActiveDirectory.Adts.Schema
{
/// <summary>
/// Partial class for DataSchemaTestSuite
/// This file is the source file for Validation of the TestCase30.
/// </summary>
public partial class DataSchemaTestSuite
{
#region WellKnownSecurityPrincipal Implementation.
/// <summary>
/// This method validates the requirements under
/// WellKnownSecurityPrincipal Scenario.
/// </summary>
public void ValidateWellKnownSecurityPrincipal()
{
DirectoryEntry dirEntry = new DirectoryEntry();
DirectoryEntry childEntry = new DirectoryEntry();
string currDomain = adAdapter.rootDomainDN;
string configNC = "CN=Configuration," + currDomain;
string schemaNC = "CN=Schema," + configNC;
//MS-ADTS-Schema_R499
if (!adAdapter.GetObjectByDN("CN=WellKnown Security Principals," + configNC, out dirEntry))
{
DataSchemaSite.Assume.IsTrue(
false,
"CN=WellKnown Security Principals,"
+ configNC
+ " Object is not found in server");
}
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=Configuration",
dirEntry.Parent.Name.ToString(),
499,
"For the WellKnownSecurityPrincipals the Parent must be config NC root object");
//MS-ADTS-Schema_R500
DataSchemaSite.CaptureRequirementIfIsTrue
(dirEntry.Properties["objectClass"].Contains((object)"container"),
500,
"For the WellKnownSecurityPrincipals the objectClass must be container");
//MS-ADTS-Schema_R501
string systemFlag = dirEntry.Properties["systemFlags"].Value.ToString();
int systemFlagVal = ParseSystemFlagsValue("FLAG_DISALLOW_DELETE");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
systemFlagVal.ToString(),
systemFlag,
501,
"For the WellKnownSecurityPrincipals the systemFlags must be FLAG_DISALLOW_DELETE");
if (systemFlag != (systemFlagVal.ToString()))
isParseSystemFlagsValue = false;
//MS-ADTS-Schema_R502
childEntry = dirEntry.Children.Find("CN=Anonymous Logon");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
502,
"For the Anonymous Logon WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R503
byte[] objSid = (byte[])childEntry.Properties["objectSid"].Value;
SecurityIdentifier sid=new SecurityIdentifier(objSid,0);
string objectSid=sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-7",
objectSid,
503,
"For the Anonymous Logon WellKnownSecurityPrincipal the objectSid must be S-1-5-7");
//MS-ADTS-Schema_R504
childEntry = dirEntry.Children.Find("CN=Authenticated Users");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
504,
@"For the Authenticated Users WellKnownSecurityPrincipal the Parent must be WellKnown
Security Principals");
//MS-ADTS-Schema_R505
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid=new SecurityIdentifier(objSid,0);
objectSid=sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-11",
objectSid,
505,
"For the Authenticated Users WellKnownSecurityPrincipal the objectSid must be S-1-5-11");
//MS-ADTS-Schema_R506
childEntry = dirEntry.Children.Find("CN=Batch");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
506,
"For the Batch WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R507
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-3",
objectSid,
507,
"For the Batch WellKnownSecurityPrincipal the objectSid must be S-1-5-3");
//MS-ADTS-Schema_R508
childEntry = dirEntry.Children.Find("CN=Creator Group");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
508,
"For the Creator Group WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R509
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-3-1",
objectSid,
509,
"For the Creator Group WellKnownSecurityPrincipal the objectSid must be S-1-3-1");
//MS-ADTS-Schema_R510
childEntry = dirEntry.Children.Find("CN=Creator Owner");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
510,
"For the Creator Owner WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R511
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-3-0",
objectSid,
511,
"For the Creator Owner WellKnownSecurityPrincipal the objectSid must be S-1-3-0");
//MS-ADTS-Schema_R512
childEntry = dirEntry.Children.Find("CN=Dialup");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
512,
"For the Dialup WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R513
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-1",
objectSid,
513,
"For the Dialup WellKnownSecurityPrincipal the objectSid must be S-1-5-1");
//MS-ADTS-Schema_R514
childEntry = dirEntry.Children.Find("CN=Digest Authentication");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
514,
@"For the Digest Authentication WellKnownSecurityPrincipal the Parent must be WellKnown
Security Principals");
//MS-ADTS-Schema_R515
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-64-21",
objectSid,
515,
"For the Digest Authentication WellKnownSecurityPrincipal the objectSid must be S-1-5-64-21");
//MS-ADTS-Schema_R516
childEntry = dirEntry.Children.Find("CN=Enterprise Domain Controllers");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
516,
@"For the Enterprise Domain Controllers WellKnownSecurityPrincipal the Parent must be WellKnown
Security Principals");
//MS-ADTS-Schema_R517
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-9",
objectSid,
517,
"For the Enterprise Domain Controllers WellKnownSecurityPrincipal the objectSid must be S-1-5-9");
//MS-ADTS-Schema_R764
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-9",
objectSid,
764,
"The member attribute of Windows Authorization Access Group Group Object "+
"must be NT AUTHORITY/ENTERPRISE DOMAIN CONTROLLERS well-known security principal (SID S-1-5-9).");
//MS-ADTS-Schema_R518
childEntry = dirEntry.Children.Find("CN=Everyone");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
518,
"For the Everyone WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R519
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-1-0",
objectSid,
519,
"For the Everyone WellKnownSecurityPrincipal the objectSid must be S-1-1-0");
//MS-ADTS-Schema_R520
childEntry = dirEntry.Children.Find("CN=Interactive");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
520,
"For the Interactive WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R521
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-4",
objectSid,
521,
"For the Interactive WellKnownSecurityPrincipal the objectSid must be S-1-5-4");
//MS-ADTS-Schema_R524
childEntry = dirEntry.Children.Find("CN=Local Service");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
524,
"For the Local Service WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R525
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-19",
objectSid,
525,
"For the Local Service WellKnownSecurityPrincipal the objectSid must be S-1-5-19");
//MS-ADTS-Schema_R526
childEntry = dirEntry.Children.Find("CN=Network");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
526,
"For the Network WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R527
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-2",
objectSid,
527,
"For the Network WellKnownSecurityPrincipal the objectSid must be S-1-5-2");
//MS-ADTS-Schema_R528
childEntry = dirEntry.Children.Find("CN=Network Service");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
528,
"For the Network Service WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R529
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-20",
objectSid,
529,
"For the Network Service WellKnownSecurityPrincipal the objectSid must be S-1-5-20");
//MS-ADTS-Schema_R530
childEntry = dirEntry.Children.Find("CN=NTLM Authentication");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
530,
@"For the NTLM Authentication WellKnownSecurityPrincipal the Parent must be WellKnown
Security Principals");
//MS-ADTS-Schema_R531
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-64-10",
objectSid,
531,
"For the NTLM Authentication WellKnownSecurityPrincipal the objectSid must be S-1-5-64-10");
//MS-ADTS-Schema_R532
childEntry = dirEntry.Children.Find("CN=Other Organization");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
532,
"For the Other Organization WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R533
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-1000",
objectSid,
533,
"For the Other Organization WellKnownSecurityPrincipal the objectSid must be S-1-5-1000");
//MS-ADTS-Schema_R536
childEntry = dirEntry.Children.Find("CN=Proxy");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
536,
"For the Proxy WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R537
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-8",
objectSid,
537,
"For the Proxy WellKnownSecurityPrincipal the objectSid must be S-1-5-8");
//MS-ADTS-Schema_R538
childEntry = dirEntry.Children.Find("CN=Remote Interactive Logon");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
538,
"For the Interactive Logon WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R539
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-14",
objectSid,
539,
"For the Remote Interactive Logon WellKnownSecurityPrincipal the objectSid must be S-1-5-14");
//MS-ADTS-Schema_R540
childEntry = dirEntry.Children.Find("CN=Restricted");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
540,
"For the Restricted WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R541
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-12",
objectSid,
541,
"For the Restricted WellKnownSecurityPrincipal the objectSid must be S-1-5-12");
//MS-ADTS-Schema_R542
childEntry = dirEntry.Children.Find("CN=SChannel Authentication");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
542,
"For SChannel Authentication WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R543
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-64-14",
objectSid,
543,
"For the SChannel Authentication WellKnownSecurityPrincipal the objectSid must be S-1-5-64-14");
//MS-ADTS-Schema_R544
childEntry = dirEntry.Children.Find("CN=Self");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
544,
"For the Self WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R545
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-10",
objectSid,
545,
"For the Self WellKnownSecurityPrincipal the objectSid must be S-1-5-10");
//MS-ADTS-Schema_R546
childEntry = dirEntry.Children.Find("CN=Service");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
546,
"For the Service WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R547
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-6",
objectSid,
547,
"For the Service WellKnownSecurityPrincipal the objectSid must be S-1-5-6");
//MS-ADTS-Schema_R550
childEntry = dirEntry.Children.Find("CN=Terminal Server User");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
550,
@"For the Terminal Server User WellKnownSecurityPrincipal the Parent must be WellKnown
Security Principals");
//MS-ADTS-Schema_R551
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-13",
objectSid,
551,
"For the Terminal Server User WellKnownSecurityPrincipal the objectSid must be S-1-5-13");
//MS-ADTS-Schema_R552
childEntry = dirEntry.Children.Find("CN=This Organization");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
552,
"For the This Organization WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R553
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-15",
objectSid,
553,
"For the This Organization WellKnownSecurityPrincipal the objectSid must be S-1-5-15");
if (serverOS >= OSVersion.WinSvr2008)
{
//MS-ADTS-Schema_R522
childEntry = dirEntry.Children.Find("CN=IUSR");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
522,
"For the IUSR WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R523
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-17",
objectSid,
523,
"For the IUSR WellKnownSecurityPrincipal the objectSid must be S-1-5-17");
//MS-ADTS-Schema_R763
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-17",
objectSid,
763,
"The member attribute of IIS_IUSRS Group Object "+
"must be NT AUTHORITY/IUSR well-known security principal (SID S-1-5-17).");
//MS-ADTS-Schema_R534
childEntry = dirEntry.Children.Find("CN=Owner Rights");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
534,
"For the Owner Rights WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R535
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-3-4",
objectSid,
535,
"For the Owner Rights WellKnownSecurityPrincipal the objectSid must be S-1-3-4");
//MS-ADTS-Schema_R548
childEntry = dirEntry.Children.Find("CN=System");
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"CN=WellKnown Security Principals",
childEntry.Parent.Name.ToString(),
548,
"For the System WellKnownSecurityPrincipal the Parent must be WellKnown Security Principals");
//MS-ADTS-Schema_R549
objSid = (byte[])childEntry.Properties["objectSid"].Value;
sid = new SecurityIdentifier(objSid, 0);
objectSid = sid.ToString();
DataSchemaSite.CaptureRequirementIfAreEqual<string>(
"S-1-5-18",
objectSid,
549,
"For the System WellKnownSecurityPrincipal the objectSid must be S-1-5-18");
}
}
#endregion
}
}