System Security Administration for NT

从MSSQL到域控:Kerberos银票攻击与令牌窃取实战剖析 在Windows域环境中,Kerberos协议是身份认证的核心机制,它通过票据(Ticket)系统实现安全的服务访问。理解其工作原理,特别是TGT(票据授予票据)与TGS(服务票据)的签发与验证流程,是掌握内网安全的关键。Kerberos的设计虽然严谨,但若服务账户密码强度不足或配置不当,攻击者便可利用其机制弱点发起攻击,例如通过Kerberoasting破解服务账户哈希,进而实施更具威胁的横向移动。这种攻击方式的价值在于它能绕过部分网络边界防护,直接针对域内信任关系进行利用。在典型的渗透测试场景中,攻击者 阅读详情
Network Solutions 
http://www.networksolutions.com 

Abstract

System security administration has, for the most part, been largely ignored as network administration has flourished. The result of this is that there are large installations of NT that need to be retrofitted with some form of security administration and management system. There are various third party tools available to assist in this endeavor, but they are somewhat general and not tailored to meet the needs of a particular user or organization. System administrators must therefore learn to mold their infrastructure to the tool, rather than the other way around. Often times, the tools may also be quite expensive, and difficult to learn and maintain. 

1. Introduction 

Security administration for a single NT system can be cumbersome, at best. There is no single interface for configuring and monitoring the security posture of an NT system. For example, the audit policy for a standalone NT system is set via the User Manager, while log specific settings and all monitored activity is recorded in the EventLog. Further, each object (file, directory, share, Registry key) has it's own interface for enabling access control lists (ACLs) and audit settings. Rolling out a common audit standard across an NT enterprise, and then monitoring the EventLogs, can be a daunting task. However, there are many third party commercial tools available to assist the system administrator. Two drawbacks of these tools are their vagueness and cost. Commercially available solutions are very general in nature, not providing the ability to focus in on the specific needs of the administrator. Some check for compliance with "best practices" but the definition of "best practices" is purely arbitrary. Other tools provide a wealth of information. In fact, they provide too much information, inundating the administrator with facts, requiring him to sift through this information and attempt to extract the real issues at hand. None of the tools take other aspects of the administrator's infrastructure into account, such as corporate security policies, the existence of a firewall, ACLs on routers, VLAN implementations on switches, etc. The cost of purchasing and installing the tools, coupled with the "cost" of deciphering the collected data, makes for a very low return on investment (ROI). Updates to the tools to look for new vulnerabilities may even be an added expense. 

System administrators need a more viable solution. The appropriate solution for a security administration system must: 

Be simple, and easy to construct and maintain. 
Be centralized. 
Be scalable. 
Be configurable, to meet the specific needs of a user. 
Provide for verification of security policy compliance (compliance checking and verification). 
Notify the administrator of systems that are not in compliance. 
Where appropriate, modify system settings to bring systems into compliance with policies. 
Reduce overall cost for administering the system (i.e., no expensive per-seat license fees, etc.). 
1.1 Purpose 
The purpose of this paper is to provide a framework, using Perl, for administering system security across an NT enterprise. Due to space limitations, all code examples cannot be presented in this paper. Additional scripts will be available via the author's web site at http://www.patriot.net/users/carvdawg/perl.html. 

1.2. Background 

The solution will be implemented in Perl, a scripting language that has been used on Unix platforms for administration purposes of years, and has been made available for the Win32 platform. ActiveState provides a fairly complete distribution of Perl for Win32 systems, as well as several avenues of support. There are also several additional modules that provide a quantum leap in functionality and usability, in the NT environment, to the ActiveState distribution. These modules provide a convenient wrapper around the Win32 API functions, making them more accessible, and easier to use and understand. This access to the Win32 API facilitates collection, and if necessary, modification, of security-relevant data for NT machines across the enterprise. 

2. Solution 

The solution for the centralized security administration of NT systems can be separated into three phases: collection, filtering/analysis, and modification. The three phases are kept distinctly separate in order to maintain simplicity, scalability and functionality. Separating the phases also makes it easier to construct a working set of tools, by allowing for testing and verification of one phase before moving on to the next. Additional functionality can be added to one phase without requiring any changes to the other phases. 

The collection phase is used to extract raw configuration data from NT machines across the enterprise: 

Generate MD5 checksums of specific files to ensure file integrity. 
Registry settings (checking for security-specific settings, trojans, viruses, etc.) 
File, directory, share and Registry key ACLs 
Services (running, stopped, and paused), the account each service runs under, and the executable called by the service 
Audit policies and EventLog entries 
User rights and user account information 
File (boot.ini) and directory ("Start Menu" for each user) contents 
This data is saved in a central location, most likely on an administration workstation, in a suitable format. The data may be written to an Access database or an Excel spreadsheet, but the simplest method is to choose a standard delimiter, such as a colon or semi-colon, and write the data to flat text files. The data is simple to parse and review, and easily compressed and encrypted for archival. The examples in this paper will send all data to STDOUT, allowing it to also be redirected to a flat file. 
The data can be easily analyzed using filters written in Perl, making use of its inherent ability to parse data and files. These filters access and process the data based on predefined conditions, making full use of the pattern matching abilities of regular expressions. Filters may be designed to check for: 

Known security issues, such as ACLs (on files, directories, and Registry keys) or specific Registry values. 
More complex issues, such as the ACLs on a file as it's related to the function of the particular system (PDC, BDC, or workstation) and a Registry key entry. 
General trends across the enterprise, such as the level of Service Packs and HotFixes installed. 
Compliance with corporate security policies, to include the audit policy for each system, or the existence of modems on workstations vice RAS servers. 
The processed information can then be presented in whichever format meets the needs of the user, to include: 
Email 
Pager 
HTML 
XML 
Word document 
Excel spreadsheet 
Access database 
EventLog entries 
The system administrator can also use Perl to act upon the information derived from filtering and analysis, making modifications as necessary. Services can be stopped or started, Registry values added or deleted, auditing can enabled, and EventLogs can be collected and filtered, all from a single workstation. 
Due to it's simple, modular nature, this system can be easily updated as new information (new vulnerabilities, updated security policies) is incorporated. 

This system can also be used to establish a baseline, which managers and administrators can use to look for system changes, or develop and implement security policies and standards. 

Once the data is filtered and analyzed, system administrators can begin the modification phase. Using the same Perl modules that were used to collect data from systems, the system administrator can bring the NT systems into compliance with security standards, by updating settings (i.e., Registry entries, file/directory/share/Registry permissions, audit policy, etc.). As this is done from a centralized location, only one account, with a strong password, is required to perform this entire range of security administration. 

Once all settings have been implemented and tested, the collection and filtering phases can again be used to verify compliance with security standards, by executing those phases as part of a regular security scan. Using the baseline information, the system administrator need only to look for anomalies and unusual settings, indicating that a lack of compliance with security policies and standards. 

As an example, assume the system administrator wishes to not only check for the existence of trojan programs on her NT servers and workstations, but she also wants to ensure that these programs (or any other programs, for that matter) can not be installed on the systems. She uses Perl scripts collect relevant data (Registry key entries and permissions, file and directory ACLs, etc.) from across the enterprise, to include offices connected to the master domain by WAN and VPN links. Once she's collected data from all systems, she filters the Registry entries based on published signatures of known trojan programs, and then reviews the entries for suspicious or unauthorized entries. Not finding anything significant, she then sets about modifying Registry and directory ACLs on all systems to prevent the installation of trojan programs in the future. She follows this up with periodic scans of the Registry keys and Security EventLog to ensure compliance, and incorporates new data, as it becomes available. The entire process is simple to maintain, and automated to reduce errors and increase efficiency. 

3. Implementation 

The examples presented in this paper are not meant to be all-inclusive. Rather, they are presented as a framework or set of tools from which system administrators can build solutions that meet their specific needs. Also, space requirements limit the number and functionality of the scripts that can be presented. Additional scripts will be available via the web, at http://www.patriot.net/users/carvdawg/perl.html. 

The following examples lay the groundwork from which specific solutions and systems can be built. 

3.1 Checksums 

The integrity of critical system files is a serious security concern, as there are publicly available web sites that demonstrate the construction of a rootkit for NT (http://www.rootkit.com). Rootkits have been a thorn in the sides of Unix administrators, as they are used to patch the kernel and trojanize commands in order to hide malicious activities. DIGEST.PL (Script 1) demonstrates a method for generating MD5 hashes of critical files. These hashes can be saved to a protected file or database and be used to verify the integrity of critical system files on a regular basis. 

3.2 Registry Settings 

The NT Registry can be as much a treasure trove as it is a technological minefield. There are several Registry values that have a direct or indirect impact on the security posture of the system. 

3.2.1 Individual Registry Values 

REGKEYS.PL (Script 2) shows how Registry values can be collected from remote NT systems. The values can then be verified, and a message printed to STDOUT for each incorrectly set Registry value. This information can be logged to a database or file, or the value simply modified as needed. For example, the system administrator can check NT systems for compliance by checking the Service Pack level on each system. 

3.2.2 Trojan Keys 

TROJANKEYS.PL (Script 3) demonstrates collecting the contents of Registry keys. The values can be scanned for known trojan signatures using the grep() function. Trojan signatures are available from anti-virus sites such as F-Secure (http://www.f-secure.com). For example, using grep(), the system administrator can quickly scan incoming data using the following signatures for network backdoor, remote administration trojan programs (signature in parens): 

ATAKA (SNDVOL.EXE) 
NetBus (Patch) 
DeepThroat (SystemDLL32) 
NetSphere (NSSX) 
GateCrasher (Command) 
Portal of Doom (ljsgz.exe) 
Girlfriend (Windll.exe) 
HackATack (Expl32.exe) 
Phase Zero (MsgServ|msgsvr32.exe) 
MyPics Variant (agent5|zip01.exe) 
NewApt (tpawen|panth) 
SubSeven (mtmtask.dl) 
By simply changing the Registry key examined, system administrators can verify which HotFixes are installed on each NT system. 
3.3 ACLs 

Access control lists (ACLs) define which users and groups have what level of access to specific resources. PERMS.PL (Script 4) demonstrates a method for collecting the ACLs from files, directories, Registry keys, and shares, and presenting the ACLs in an easy to understand format. Credit goes to Dave Roth for both his Win32::Perms module, as well as the code for the getperms() method. 

3.4 Services 

SERVICES.PL (Script 5) demonstrates a method for collecting information from services available on NT systems, such as the service's status, the service executable, and the account that the service runs under. Other methods in the Win32::Lanman module will allow the system administrator to start or stop services. Dave Roth's Win32::Daemon module provides a nice interface for creating services from Perl scripts. 

3.5 Auditing and Logging 

NT systems have the capability of performing auditing and logging functions. Administrators can use the information available in the EventLog to see if there are problems with applications, look for clean or dirty system shutdowns, or even as a rudimentary intrusion detection system. 

3.5.1 Audit Policies 

The AUDITPOL.PL (Script 6) script shows how the audit policy can be determined. Auditing can be enabled if the current state shows it to be disabled, and the particular events to be audited can be set. 

3.5.2 EventLog Entries 

The DUMPEVENTS.PL (Script 7) script demonstrates a means of collecting EventLog entries from multiple machines within the domain. The script collects the entries and sends them to STDOUT. However, the entries can be deposited in an Excel spreadsheet or Access database, making the entries more manageable. Specific events can be filtered during the collection process, such as Dr. Watson messages, failed logon attempts, etc. If ACLs are set to prevent users from writing to specific directories and Registry keys, attempts to do so (as when the user attempts to install software, or when a trojan attempts to install itself) appear as EventID 650 in the Security EventLog. 

3.6 User Privileges and User Account Information 

The administrator may need to determine the privileges that users have available in order to diagnosis access issues. The Win32::Lanman module provides methods for displaying privileges assigned to particular users or groups, or assigning privileges as necessary. 

USERS.PL (Script 8) demonstrates how an administrator might collect information about user accounts from the local NT system. Other Win32::Lanman methods allow the administrator to enumerate global and local groups, or add users and groups. 

3.7 Directory and File Contents 

STARTUPCHK.PL (Script 9) shows how an administrator can examine the contents of the Start Up directories for all profiles on an NT system. This script will also show the executable files pointed to by shortcuts. 

Administrators can also use Perl to get the contents of particular files, such as boot.ini or lmhosts, in order to aid in troubleshooting problems. 

4. Conclusions 

The system and example scripts presented in this paper are quite simple, yet scalable and easy to maintain. All requirements for a security administration system have been met, to include reducing overall cost. At the same time, system administrators using this model have an understanding of the necessity for maintaining the security of their NT systems. They also have a complete security administration toolkit consisting of resources for NT-specific security information, a powerful scripting language (Perl), and a wide variety of tools and techniques to make their jobs easier and more efficient. 

Using other modules, system administrators can perform a wide variety of other centralized security administration tasks. For example, there are modules available that allow the system administrator to interface with the Performance Monitor on remote NT systems to check running processes. System administrators can also use Win32::OLE to interface locally with IIS 4.0's metabase and make configuration changes, or use LWP::UserAgent to test their IIS 4.0 web servers for susceptibility to the latest exploit (note: Rain Forest Puppy's whisker.pl is uses Socket.pm to provide the functionality of LWP::UserAgent). 

5. Appendix A: Resources 

5.1 Perl on NT 

All scripts associated with this paper were written and tested using ActiveState's ActivePerl build 522 on Windows NT 4.0. At the time of this writing, ActivePerl build 522 was available from ftp://ftp.activestate.com/ActivePerl/Windows/5.005/Intel/. 

5.2 Extensions 

The following extensions are available as part of the default distribution of ActiveState's ActivePerl: 

Win32::TieRegistry 
Win32::Shortcut 
The Digest::MD5 module is not installed as part of the standard distribution, but is available via PPM ("ppm install Digest-MD5"). 
The following extensions are available from Dave Roth's web site, and installable via PPM: 

Win32::AdminMisc 
Win32::Perms 
The Win32::Lanman module, authored by Jens Helberg (jens.helberg@bosch.com),  is available in a zipped archive from Dave Roth's FTP site (ftp://ftp.roth.net/ntperl/Others/Lanman/lanman_1_05.zip) or it can be installed via PPM from http://jenda.mccann.cz/perl/. 
5.3 Books and Papers 

Schwartz, R. L., Olson, E., and Christiansen, T., "Learning Perl on Win32 Systems", O'Reilly & Associates, 1997 

Roth, D., "Win32 Programming: The Standard Extensions", MacMillian Technical Publishing, 1998 

Roth, D., "A Network Machine Management System", USENIX's 2nd Large Installation System Administration of Windows NT (LISA-NT) Conference, July, 1999 

Jumes, J. G., Cooper, N. F., Chamoun, P., and Feinman, T. M., "Windows NT 4.0 Security, Audit, and Control", Microsoft Press, 1999 

5.4 Web Sites 

The author's web site lists several scripts which could not be listed in this paper due to space requirements (http://www.patriot.net/users/carvdawg/perl.html). 

Dave Roth's site is the home of several extremely useful Perl modules, as well as his paper from the Usenix LISA-NT '99 Conference (http://www.roth.net) 

Joe Casadonte's web site lists many modules available for NT (http://www.netaxs.com/~joc/perlwin32.html) 

6. Appendix B: Scripts 

6.1 Digest.pl (Script 1) 

#! c:/perl/bin/perl.exe 
# digest.pl 
# Generate MD5 checksums on files to verify file 
# integrity 
# Use with system files, web pages, etc. Can also use 
# files on mapped drives, but must use complete path. 

use strict; 
use Digest::MD5; 

my $server = shift || Win32::NodeName; 
my @files = ("io.sys","ntldr","boot.ini","ntdetect.com", "winnt//system32//fpnwclnt.dll"); 
my $path; 
$server =~ y/a-z/A-Z/; 
($server eq Win32::NodeName) ? ($path = "c://") : 
($path = "////$server//c/$//"); 
foreach (@files) { 
    my $file = $path.$_; 
    if (-e $file) { 
        my $hash = hash($file); 
        print "$server/t$file =>; $hash/n"; 
    } 
    else { 
        print "$file could not be found./n"; 
    } 
} 

# sub() to generate the actual hash 
sub hash { 
    my ($file) = @_; 
    open (FILE, $file) or die "Can't open $file: $!/n"; 
    binmode(FILE); 
    my $digest = Digest::MD5->;new->;addfile(*FILE)->;b64digest; 
    return $digest; 
} 

6.2 Regkeys.pl (Script 2) 

#! c:/perl/bin/perl.exe 
# RegKeys.pl 
# Collect Registry key values for analysis 

use strict; 
use Win32::TieRegistry(Delimiter=>;"/"); 

my $server = shift || Win32::NodeName; 
my $remote; 
if ($remote = $Registry->;{"//$server/LMachine"}) { 
    /&getRegValues($server); 
} 
else { 
    print "Could not connect to $server Registry./n"; 
} 

sub getRegValues { 
    my($value,$data); 
    my %regkeys = (); 
# Keys are kept in a datafile, in format: Value;Path 
# Ex: EnableDCOM;SOFTWARE/Microsoft/Ole 
    my $datafile = "RegKeyValues"; 
    if (-e $datafile) { 
        open(FL,$datafile) || die "Could not open  $datafile: $!/n"; 
        while(<FL>;) { 
            chomp; 
# Skip comments and blank lines 
            next if ($_ =~ m/^#/); 
            next if ($_ =~ m/^/s+$/); 
            my($key,$path) = split(/;/,$_); 
            $regkeys{$key} = $path; 
        } 
        close(FL); 
        foreach my $key (keys %regkeys) { 
            $value = $remote->;{$regkeys{$key}}; 
            $data = $value->;{$key}; 
            if (defined $data) { 
                $data = hex($data) if ($data =~ m/^0x/); 
                print "$key = $data/n"; 
            } 
            else { 
                print "$key = NotFound/n"; 
            } 
        } 
    } 
} 

6.3 TrojanKeys.pl (Script 3) 

#! c:/perl/bin/perl.exe 
# trojankeys.pl 
# Check Registry keys where trojans 
# like to hide for suspicious entries 

use strict; 
use Win32::TieRegistry(Delimiter=>;"/"); 
my ($remote); 
my $server = shift || Win32::NodeName; 
my %hives = ("LMachine" =>; "HKLM", "CUser" =>; "HKCU"); 
foreach my $hive (keys %hives) { 
    print "Checking $hives{$hive} hive.../n"; 
    ($remote = $Registry->;{"//$server/$hive"}) ? 
    (/&amp;getTrojanKeys($server)) : 
    (print "Could not connect to $hives{$hive} hive./n"); 
    print "/n"; 
} 

sub getTrojanKeys { 
    my($path) = 'SOFTWARE/Microsoft/Windows/CurrentVersion'; 
    my(@keys) = ('Run','RunOnce','RunOnceEx','RunServices'); 
    foreach my $k (@keys) { 
        my $key = $remote->;{"$path/$k"}; 
        if (defined $key) { 
            my @vals = $key->;ValueNames; 
            if($#vals != -1) { 
                foreach my $val (@vals) { 
                    my $data = $key->;{$val}; 
                    $data = "NotFound" unless($data); 
                    print "$k:$val:$data/n"; 
                } 
            } 
        } 
    } 
} 

6.4 Perms.pl (Script 4) 

#! c:/perl/bin/perl.exe 
# Perms.pl 
# usage: perl perms.pl [obj] 
# ex: perl perms.pl c:/winnt 

use strict; 
use Win32::Perms; 

my $obj = shift || die "You must enter an object: File, Dir, or Reg key./n"; 
/&amp;getperms($obj); 

# Credit goes to Dave Roth for providing the following code to translate the DACL mask 
# into something readable; ie, Explorer-like listing 
sub getperms { 
    my($obj) = @_; 
    my($Acct,@List,$Path,$iTotal,@String); 
    my($Perm) = new Win32::Perms($obj); 
    my (%PERM) = (R =>; 0, W =>; 1, 
                                 X =>; 2, D =>; 3, 
                                 P =>; 4, O =>; 5, 
                                A =>; 6); 

    my(%MAP) = ('FILE_READ_DATA' =>; 'R', 
                           'GENERIC_READ' =>; 'R', 
                           'KEY_READ' =>; 'R', 
                           'KEY_QUERY_VALUE' =>; 'R', 
                           'FILE_WRITE_DATA' =>; 'W', 
                           'KEY_WRITE' =>; 'W', 
                           'GENERIC_WRITE' =>; 'W', 
                           'KEY_SET_VALUE' =>; 'W', 
                           'DELETE' =>; 'D', 
                           'FILE_DELETE_CHILD' =>; 'D', 
                           'FILE_EXECUTE' =>; 'X', 
                           'FILE_TRAVERSE' =>; 'X', 
                           'GENERIC_EXECUTE' =>; 'X', 
                           'CHANGE_PERMISSION' =>; 'P', 
                           'TAKE_OWNERSHIP' =>; 'O', 
                           'FILE_ALL_ACCESS' =>; 'A', 
                           'GENERIC_ALL' =>; 'A', 
                           'STANDARD_RIGHTS_ALL'  =>;'A'); 

    die "Can not obtain permissions for '$Path'/n"  if  (!$Perm); 

    $Perm->;Dump(/@List); 
    foreach $Acct (@List) { 
        my($Perm); 
        my(@String) = split(//, "-" x scalar(keys(%PERM))); 
        my($Mask,@M,@F); 
        my($DaclType); 
        next if($Acct->;{Entry} ne "DACL"); 
        $iTotal++; 
        DecodeMask($Acct,/@M,/@F); 
        foreach $Mask (@M) { 
            $Perm |= 2**$PERM{$MAP{$Mask}}; 
        } 
        foreach $Mask (keys(%PERM)) { 
            $String[$PERM{$Mask}] = $Mask if ($Perm &amp; 2**$PERM{$Mask}) ; 
        } 
        $DaclType = $Acct->;{ObjectName}; 
        if( 2 == $Acct->;{ObjectType} ) { 
# We have either a file or directory. Therefore we need to figure out if this 
# DACL represents an object (file) or a container (dir)... 
            ($Acct->;{Flag} &amp; DIR) ? ($DaclType = "Directory") : ($DaclType = "File"); 
        } 
        my $permstr = join("",@String); 
        print "$Acct->;{Account}:$DaclType:$permstr/n"; 
    } 
    print "Everyone has full permissions./n" if(!$iTotal); 
} 

6.5 Services.pl (Script 5) 

#! c:/perl/bin/perl.exe 
# Services.pl 
# Retrieve info on services on $server 

use strict; 
use Win32::Lanman; 
my $server = shift || Win32::NodeName; 
/&amp;Services($server); 

sub Services { 
    my($server) = @_; 
# Array to translate the current state of the service into something readable 
    my(@state) = ("","Stopped","Start_Pending","Stop_Pending", "Running", 
                              "Continue_Pending","Pause_Pending","Paused"); 
# Array to translate the startup options for the service into something readable 
    my(@startup) = ("","","Automatic","Manual","Disabled"); 
    my($err,@services,$service,%info); 
    if (Win32::Lanman::EnumServicesStatus("////$server","",&amp;SERVICE_WIN32, 
                                &amp;SERVICE_STATE_ALL,/@services)) { 
        foreach $service (@services) { 
            if (Win32::Lanman::QueryServiceConfig("////$server","",${$service}{name},/%info)) { 
# Print out in an easy to read format 
                print "${$service}{display}/n"; 
                print "/tName/t${$service}{name}/n"; 
                print "/tState/t".$state[${$service}{state}]."/n"; 
                print "/tAccount/t$info{account}/n"; 
                print "/tFile/t$info{filename}/n"; 
                print "/tStart/t".$startup[$info{start}]."/n"; 
                print "/n"; 
            } 
            else { 
                $err = Win32::FormatMessage Win32::Lanman::GetLastError(); 
                $err = Win32::Lanman::GetLastError() if ($err eq ""); 
                print "$server: QueryServiceConfig Error: $err"; 
            } 
        } 
    } 
    else { 
        $err = Win32::FormatMessage Win32::Lanman::GetLastError(); 
        $err = Win32::Lanman::GetLastError() if ($err eq ""); 
        print "$server: Services Error: $err"; 
    } 
} 

6.6 AuditPol.pl (Script 6) 

#! c:/perl/bin/perl.exe 
# auditpol.pl 
# Determine the audit policy of an NT system 

use strict(vars); 
use Win32::Lanman; 

my $server = shift || Win32::NodeName; 
/&amp;AuditPol($server); 

sub AuditPol { 
    my($server) = @_; 
    my(%info); 
    my(%hash) = ("AuditCategoryLogon" =>; "Logon and Logoff", 
            "AuditCategoryObjectAccess" =>; "File and Object Access", 
            "AuditCategoryPrivilegeUse" =>; "Use of User Rights", 
            "AuditCategoryAccountManagement" =>; "User/Group Mgmt", 
            "AuditCategoryPolicyChange" =>; "Security Policy Changes", 
            "AuditCategorySystem" =>; "Restart and Shutdown System", 
            "AuditCategoryDetailedTracking" =>; "Process Tracking"); 

    my(%settings) = (0 =>; "None", 
                                    1 =>; "Success", 
                                    2 =>; "Failure", 
                                    3 =>; "Success and Failure"); 

    if (Win32::Lanman::LsaQueryAuditEventsPolicy("////$server",/%info)) { 
        my $audit = $info{auditingmode}; 
        if (!$audit) { 
            print "$server: Auditing is NOT enabled!/n"; 
        } 
        else { 
            print "/n"; 
            printf "%-35s %-20s/n","Audit Events","Settings"; 
            printf "%-35s %-20s/n","------------","--------"; 
            my $options = $info{eventauditingoptions}; 
            foreach my $key (keys %hash) { 
                printf "%-35s %-20s/n", $hash{$key},$settings{$$options[&amp;$key]}; 
            } 
        } 
    } 
    else { 
        my $err = Win32::FormatMessage Win32::Lanman::GetLastError(); 
        print "$server: Audit Error: $err/n"; 
    } 
} 

6.7 DumpEvents.pl (Script 7) 

#! c:/perl/bin/perl.exe 
# Dumpevents.pl 

use strict; 
use Win32::Lanman; 
use Win32::Perms; 

my $server = shift || Win32::NodeName; 

# This is an important setting, to prevent your 
Win32::Perms::LookupDC(0); 
/&amp;GetEvents($server,"Security"); 

sub GetEvents { 
    my($server,$evtlog) = @_; 
    my(@events,$event,$desc); 
    my %types = (1 =>; "(Error)", 
                             4 =>; "(Information)", 
                             8 =>; "(Success Audit)", 
                             16 =>; "(Failure Audit)"); 

    my %category = (0 =>; "(None)", 
                                    1 =>; "(System Event)", 
                                    2 =>; "(Logon/Logoff)", 
                                    3 =>; "(Object Access)", 
                                    4 =>; "(Privilege Use)"); 

    if(Win32::Lanman::ReadEventLog("////$server", $evtlog, 0xffffffff, 0, /@events)) { 
        foreach $event (@events) { 
            print"Computer: ".${$event}{computername}."/n"; 
            print "Category:".${$event}{eventcategory}." ".$category{${$event}{eventcategory}}."/n"; 
            my $id = (${$event}{eventid} &amp; 0xffff); 

# Use the EventID to filter on specific types of events 
            print "Event ID: ".$id."/n"; 
            print "EventType: ".${$event}{eventtype}." ".$types{${$event}{eventtype}}."/n"; 
            print "Source: ".${$event}{source}."/n"; 
            print "SourceName: ".${$event}{sourcename}."/n"; 
            print"Generated: ".localtime(${$event}{timegenerated})."/n"; 
            print "Written: ".localtime(${$event}{timewritten})."/n"; 
            print "Flags: ".${$event}{reservedflags}."/n"; 
            print "User: ".Win32::Perms::ResolveAccount(${$event}{usersid})."/n"; 
            print "Description: "; 
            if (Win32::Lanman::GetEventDescription("////$server", $event)) { 
                $desc = ${$event}{eventdescription}; 
                print $desc."/n"; 
            } 
            else { 
                my $strings = ${$event}{strings}; 
                print "/n"; 
                foreach (@$strings) { 
                    print "/t+".$_."/n"; 
                } 
            } 
# print "Data:".unpack("H".2*length(${$event}{data}), ${$event}{data})."/n" 
# if (${$event}{data} ne ""); 
            print "/n/n"; 
        } 
    } 
    else { 
        my $err = Win32::FormatMessage Win32::Lanman::GetLastError(); 
        $err = Win32::Lanman::GetLastError() if ($err eq ""); 
        print "$server: ReadEventLog error: $err./n"; 
    } 
} 

6.8 Users.pl (Script 8) 

#! c:/perl/bin/perl.exe 
# Users.pl 
# Get user info from local system 

use strict; 
use Win32::Lanman; 

my $server = shift || Win32::NodeName; 
print "$server users.../n"; 
/&amp;GetUserInfo($server); 

sub GetUserInfo { 
    my($server) = @_; 
    my(@users,$user,$pwage); 
    if (Win32::Lanman::NetUserEnum("////$server",0,/@users)) { 
        foreach my $user (@users) { 
            $pwage = (split(//./,${$user}{'password_age'}))/(3600*24); 
            print "${$user}{'name'}/n"; 
            print "/tComment =>; ${$user}{'comment'}/n"; 
            print "/tUID =>; ${$user}{'user_id'}/n"; 
            print "/tPasswd Age =>; $pwage/n"; 
#         print "/tLogon Svr =>; ${$user}{'logon_server'}/n"; 
            print "/tLast Logon =>;".mlocaltime(${$user}{'last_logon'})."/n"; 
            print "/tLast Logoff =>;".mlocaltime(${$user}{'last_logoff'})."/n"; 
            print "/tAccount does not expire./n" if (${$user}{'acct_expires'} == -1); 
            print "/tACCOUNT DISABLED./n" if (${$user}{'flags'} &amp; UF_ACCOUNTDISABLE); 
            print "/tUser cannot change password./n" if (${$user}{'flags'} &amp; UF_PASSWD_CANT_CHANGE); 
            print "/tAccount is locked out./n" if (${$user}{'flags'} &amp; UF_LOCKOUT); 
            print "/tPassword does not expire./n" if (${$user}{'flags'} &amp; UF_DONT_EXPIRE_PASSWD); 
            print "/tPassword not required./n" if (${$user}{'flags'} &amp; UF_PASSWD_NOTREQD); 
            print "/n/n"; 
        } 
    } 
    else { 
        my $err = Win32::FormatMessage Win32::Lanman::GetLastError(); 
        $err = Win32::Lanman::GetLastError() if ($err eq ""); 
        print "NetUserEnum Error: $err/n"; 
    } 
} 

sub mlocaltime { 
    ($_[0] == 0) ? (return "Never") : (return localtime($_[0])); 
} 

6.9 StartUpChk.pl (Script 9) 

#! c:/perl/bin/perl.exe 
# StartUpChk.pl 
# Checks contents of StartUp folder 
# for each profile 

use strict; 
use Win32::Shortcut; 

my $server = shift || Win32::NodeName; 
my $me = Win32::NodeName; 

my $startdir; 
($server eq $me) ? ($startdir = "c://") : ($startdir = "////$server//c/$//"); 
my $start = $startdir."winnt//profiles//"; 
my $startup = "//start menu//programs//startup"; 
my ($dir,$err); 
if (-e $start &amp;&amp; -d $start) { 
    opendir(ST,"$start"); 
    foreach $dir (sort readdir(ST)) { 
        next if ($dir eq "." || $dir eq ".."); 
        my $dir2 = $start.$dir; 
        if (-e $dir2 &amp;&amp; -d $dir2) { 
            my $newdir = "$start".$dir."$startup"; 
            if (-e $newdir &amp;&amp; -d $newdir) { 
                opendir(SUP,$newdir); 
                my @files = readdir(SUP); 
                closedir(SUP); 
                if (@files) { 
                    foreach my $file (@files) { 
                        next if ($file eq "." || $file eq ".."); 
                        if ($file =~ m/lnk$/) { 
                            my $shortcut = Win32::Shortcut->;new($newdir."//".$file); 
                            ($shortcut) ? (print "$dir:$file:$shortcut->;{Path}/n") : (print "Error with Shortcut: ".Win32::FormatMessage Win32::GetLastError."/n"); 
                        } 
                        else { 
                            print "$dir:$file/n"; 
                        } 
                    } 
                } 
            } 
            else { 
                print "$newdir does not exist or is not a directory./n"; 
            } 
        } 
        else { 
            print "$dir2 does not exist or is not a directory./n"; 
        } 
    } 
    closedir(ST); 
} 
else { 
    print "$start does not exist or is not a directory./n"; 
}
 
深度剖析CVE-2025-21333:Hyper-V内核驱动漏洞原理、影响与实战分析 内核驱动是操作系统核心组件,运行在最高特权级别(Ring 0),负责管理系统硬件资源和关键服务。其安全漏洞,特别是本地特权提升漏洞,允许攻击者从较低权限突破至内核级控制,对系统机密性、完整性和可用性构成严重威胁。这类漏洞的技术价值在于揭示了系统安全边界中最脆弱的环节,常被用于高级持续性威胁和虚拟机逃逸攻击。在虚拟化场景中,宿主机内核驱动的安全性直接决定了其上所有虚拟机的隔离有效性。本文聚焦于近期披露的CVE-2025-21333,这是一个存在于Windows Hyper-V虚拟化服务提供程序(VSP)中的高 阅读详情

相关推荐

Windows零点击攻击防御实战:Shell 0-Click与BlueHammer攻击链深度解析

零点击攻击是一种无需用户交互即可触发的高级威胁,它通过利用系统或应用中的漏洞实现静默入侵,彻底绕过了传统安全模型中“人”的环节。其技术原理通常涉及对网络协议、内存管理或系统组件的深入利用,例如通过精心构造的恶意数据包触发内存破坏漏洞,或滥用系统服务间的信任关系。这种攻击方式的技术价值在于其极高的隐蔽性和成功率,能够穿透常规的边界防御和用户意识防线,对关键基础设施和企业网络构成严重威胁。在应用场景上,零点击攻击常被用于针对高价值目标的定向攻击,如政府机构、金融机构和大型企业的网络渗透。本文以Windows系统

weixin_34268579的博客 407

Kerberos常见问题

Error Messages to Fear 参考地址:Introduction · Hadoop and Kerberos: The Madness Beyond the Gate Security error messages appear to take pride in providing limited information. In particular, they are usually some generic IOException wrapping a generic securit

wank1259162的博客 1万+

Windows Admin Center高危RCE漏洞深度解析与紧急加固指南

远程代码执行(RCE)漏洞是Web应用安全领域的核心威胁之一,其原理通常源于对用户输入验证不严,导致攻击者注入的恶意代码在服务器端以高权限执行。这类漏洞的技术价值在于能直接获取系统控制权,破坏性极强,常被用于服务器渗透、数据窃取和横向移动。在服务器管理场景中,基于Web的集中管理工具因其强大的功能而成为高价值目标,一旦出现漏洞,风险巨大。本文聚焦于近期曝出的Windows Admin Center高危RCE漏洞,该漏洞利用链清晰,可实现“一次点击”接管服务器,对本地部署环境构成严重威胁。文章深入拆解了其攻击

weixin_34072637的博客 428

CentOS 7 编译LibreOffice 时提示 cpan -i Digest::MD5

编译LibreOffice 时提示错误: The missing Perl modules are: Digest::MD5 Install them as superuser/administrator with “cpan -i Digest::MD5” 解决方案: 切换到root权限 1.安装cpan yum -y install cpan 或 sudo yum -y install perl-CPAN 2.安装perl-Test-Simple yum install perl-Test-Sim

huqngqing的博客 720

Rockchip固件烧录工具AndroidTool_Release及使用说明

Rockchip固件烧录工具AndroidTool_Release,rockusb驱动安装助手,及使用说明

从CAD到完美网格:HyperMesh几何清理全流程指南(2023最新版)

本文详细介绍了2023最新版HyperMesh在几何清理和网格划分方面的全流程操作指南。从CAD导入、几何修复到中面提取和网格生成,系统性地分享了实战验证的解决方案,帮助工程师高效处理复杂几何体,提升有限元模型质量。特别针对汽车和航空航天领域的常见问题,提供了智能化工具和优化技巧。

weixin_29306011的博客 228

RK Linux工具烧录错误分析

Rockusb>UF No found firmware item from config!

Norton的专栏 8025

MICROSAR OS:第一个task是如何执行起来的?

MICROSAR OS是Vector公司开发的符合AUTOSAR OS规范的实时操作系统。本文介绍MICROSAR

humu7733的博客 2575

Failed to open file ''****.sql'', error: 2的解决方案

将source后面的路径的引号去掉: source '/home/python/study/flask/information_info_category.sql' # 改为 source /home/python/study/flask/information_info_category.sql

凤凰人 3万+

Workbench中基于nCode的列车转向架随机振动疲劳寿命预测方法

本文详细介绍了在ANSYS Workbench中结合nCode进行列车转向架随机振动疲劳寿命预测的完整方法。通过几何清理、模态分析、PSD载荷定义及随机振动求解,并重点阐述了nCode中Dirlik等疲劳算法的选择与应用,为轨道交通关键部件的可靠性设计提供了系统的仿真分析流程与工程实践指导。

weixin_29234423的博客 474

思科网络进阶——多生成树协议(MSTP)配置的一课一得

三、实验拓扑1)设计一个网络架构,要有核心层和接入层,都使用思科交换机。2)企业有4个部门,要求这四个部门都可以上网,但分属不同的VLAN中,这样今后可以做其它安全策略以确保网络安全,这些策略如今后学到的访问控制列表ACL。3)网络架构的设计要具有冗余,防止一条线路或一台设备终端导致的业务中断。4)由于硬件冗余而产生的环路要处理好,也就是要在逻辑上(或者说通过配置)防止物理环路的产生。5)不能因为防止物理环路而导致某端口没有流量,这样浪费端口资源及设备间互联的带宽资源。

zhu52010的博客 3400

使用source导入MySQL出现“ERROR: Failed to open file xx, error: 2“问题的解决

可以看看是不是文件类型没有变成.sql文件。 如果仍然是.txt文件类型,改变过来就可以啦! 如果“重命名”不能改变的话,可以试一下打开文件然后另存为,将文件类型改为所有文件,然后在命名上加上.sql

m0_64049404的博客 1977

杰理外挂flash使用教程(四):制作fat32文件系统格式的资源文件

本文档提供了FAT文件系统镜像生成与资源打包的完整指南,包含两种实现方案:推荐的WSL/Ubuntu环境方案和Windows原生方案。详细说明了从创建空白镜像、格式化、资源文件复制到最终打包为设备可用的res.bin文件的完整流程,并对比了FAT32与FAT16的特性差异。文档还包含关键文件说明、使用注意事项和典型应用场景,适用于嵌入式系统开发、固件升级等场景。

qq_42014563的博客 1341

告别图形界面:掌握这100个Windows CMD命令,高效完成90%的日常操作

gpedit.msc—–组策略2. sndrec32——-录音机3. Nslookup——-IP地址侦测器 ,是一个 监测网络中 DNS 服务器是否能正确实现域名解析的命令行工具。它在 Windows NT/2000/XP 中均可使用 , 但在 Windows 98 中却没有集成这一个工具。4. explorer——-打开资源管理器5. logoff———注销命令6. shutdown——-60秒倒计时关机命令7. lusrmgr.msc—-本机用户和组。

xx16755498979的博客 296

头歌OpenGauss数据库-G.视图的使用

OpenGauss数据库-G.视图的使用

python一生之敌的博客 1386

【基于Arduino 的CNC笔式绘图仪】

该机器的结构基于我之前视频中的DIY CNC激光雕刻机,目标是以尽可能少的零件制造最简单的CNC机器。它使用 3 个 NEMA 17 步进电机进行 X、Y 和 Z 轴运动,并使用一个小伺服器进行夹持器。这款数控笔式绘图仪的大脑是一块Arduino UNO板,结合了一个数控屏蔽和三个A4988步进驱动器。在我看来,相当大的工作区域,360x280mm,以及这款笔式绘图仪可以输出的细节水平也令人印象深刻。我真的很惊讶这些图纸的好坏和精确程度,尤其是我使用0.6毫米中性笔的图纸。

vor234的博客 1502

【Linux公有云网站配置实战|企业网络管理课程溯源、完整实训、例题解析与故障排错】

文末整理配套学习网站、网课、专业书籍。早期网络依靠人工经验维护,没有标准化流程、统一配置规范,网络故障频繁,于是各大高校开设企业网络管理相关课程,目的是培养能够维护企业内网、服务器、对外业务网站的专业运维人员。本次实训基于公有云服务器,以Linux操作系统为基础,完整完成云服务器初始化、远程连接、Web服务安装、网站源码部署、防火墙与云安全组放行,最终实现公网用户通过IP访问企业网站。Linux系统凭借稳定、开源、免费的优势成为企业服务器首选,课程新增Linux命令、用户管理、服务部署、防火墙配置内容。

2501_92125808的博客 341

013:无人机航线规划的概念

航线规划是无人机任务规划的核心环节,它决定了无人机在整个任务执行过程中的飞行路径。航线规划需要考虑多种因素,包括飞行时间、飞行距离、能源消耗、飞行安全等。

qq_31762031的博客 2444

渗透测试 ( 3 ) --- Metasploit Framework (MSF)

Metasploit专业版和精简版的主要差别在于专业版上面集成了全自动攻击模块,通过远程API集成网络分割测试模块、标准基线审计向导模块、闭环漏洞验证优先处理功能、动态载荷规避防病毒解决方案、钓鱼意识管理和鱼叉式网络钓鱼模块、对OWASP Top 10漏洞的Web应用程序测试模块、高级命令行和Web界面的选择模块。但是,专业版是必须要付费的,所以除非用到非个人的功能,否则没有必要去使用专业版,而且,专业版和精简版的渗透攻击模块是一样的。.........

freeking101的博客 1万+

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

服务器统一命名规范

将lqs更新为optmv_sci2_user02。

hezhensheng007的专栏 240

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

WorkBuddy安装全指南:系统依赖、版本辨析与Windows深度适配

WorkBuddy并非传统办公套件,而是一款以任务流为中心的协作操作系统,其核心原理在于通过深度系统集成(如Windows服务、IPC通信、本地加密存储)实现跨应用信息联动。技术价值体现在打破Office/WPS等工具的信息孤岛局限,支撑实时协同、自动沉淀与组织知识管理。典型应用场景包括企业微信/钉钉审批嵌入、多源数据统一视图、离线优先的混合工作流。本文聚焦Windows平台落地难点,详解.NET 6运行时绑定、ARM/x64架构识别、LocalSystem服务权限配置等关键安装前提,并揭示社区版、腾讯定制

weixin_34126557的博客 1020

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

数据库——MySQL

MySQL数据库基础教程全面介绍了关系型数据库的核心概念和操作。

qq_46518480的博客 418

Failed to open file ‘****‘, error: 2

mysql执行sql脚本,找不到文件

qq_50209297的博客 882
上一篇: 解剖安全帐号管理器(SAM)结构
下一篇: Google公司都有什么牛人
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值