System Security Administration for NT

深度剖析CVE-2025-21333:Hyper-V内核驱动漏洞原理、影响与实战分析 内核驱动是操作系统核心组件,运行在最高特权级别(Ring 0),负责管理系统硬件资源和关键服务。其安全漏洞,特别是本地特权提升漏洞,允许攻击者从较低权限突破至内核级控制,对系统机密性、完整性和可用性构成严重威胁。这类漏洞的技术价值在于揭示了系统安全边界中最脆弱的环节,常被用于高级持续性威胁和虚拟机逃逸攻击。在虚拟化场景中,宿主机内核驱动的安全性直接决定了其上所有虚拟机的隔离有效性。本文聚焦于近期披露的CVE-2025-21333,这是一个存在于Windows Hyper-V虚拟化服务提供程序(VSP)中的高 阅读详情
文章来源: http://www.usenix.org/
文章提交: xyzw (xyzw_at_963.net)

System Security Administration for NT
Harlan Carvey
hcarvey@netsol.com

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"}) ?
    (/&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";
/&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 & 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} & 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;
/&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","",&SERVICE_WIN32,
                                &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;
/&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[&$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);
/&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} & 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";
/&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'} & UF_ACCOUNTDISABLE);
            print "/tUser cannot change password./n" if (${$user}{'flags'} & UF_PASSWD_CANT_CHANGE);
            print "/tAccount is locked out./n" if (${$user}{'flags'} & UF_LOCKOUT);
            print "/tPassword does not expire./n" if (${$user}{'flags'} & UF_DONT_EXPIRE_PASSWD);
            print "/tPassword not required./n" if (${$user}{'flags'} & 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 && -d $start) {
    opendir(ST,"$start");
    foreach $dir (sort readdir(ST)) {
        next if ($dir eq "." || $dir eq "..");
        my $dir2 = $start.$dir;
        if (-e $dir2 && -d $dir2) {
            my $newdir = "$start".$dir."$startup";
            if (-e $newdir && -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";
}


--------------------------------------------------------------------------------
This paper was originally published in the Proceedings of LISA-NT -- The 3rd Large Installation System Administration of Windows NT Conference, August 1-2, 2000, Seattle, Washington, USA
Last changed: 6 July 2000 mc
 
Windows零点击攻击防御实战:Shell 0-Click与BlueHammer攻击链深度解析 零点击攻击是一种无需用户交互即可触发的高级威胁,它通过利用系统或应用中的漏洞实现静默入侵,彻底绕过了传统安全模型中“人”的环节。其技术原理通常涉及对网络协议、内存管理或系统组件的深入利用,例如通过精心构造的恶意数据包触发内存破坏漏洞,或滥用系统服务间的信任关系。这种攻击方式的技术价值在于其极高的隐蔽性和成功率,能够穿透常规的边界防御和用户意识防线,对关键基础设施和企业网络构成严重威胁。在应用场景上,零点击攻击常被用于针对高价值目标的定向攻击,如政府机构、金融机构和大型企业的网络渗透。本文以Windows系统 阅读详情

相关推荐

uniapp map地图实现marker聚合点,并点击marker触发事件

【代码】uniapp map地图实现marker聚合点,并点击marker触发事件。

weixin_44705979的博客 5437

从MSSQL到域控:Kerberos银票攻击与令牌窃取实战剖析

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

culuo8053的博客 516

SoC低功耗设计实战:28nm工艺下四核A7的Hierarchical Flow全流程解析

本文深入解析了在TSMC 28nm工艺上,采用Hierarchical Flow(层次化流程)实现四核Cortex-A7 SoC低功耗设计的全流程。文章从项目背景切入,详细探讨了基于UPF的电源规划、时钟树综合、接口时序收敛以及物理验证等关键环节,分享了使用Cadence Innovus等工具进行低功耗物理实现的实战经验与挑战。

weixin_29231263的博客 325

GCC编译选项参数

GCC 编译选项参数 1 常用选项 2 预处理器选项 -includefile 在处理常规输入文件之前,首先处理文件file,其结果是,文件file的内容先得到编译.命令行上任何-D'和-U’选项永远在-includefile'之前处理,无论他们在命令行上的顺序如何.然而-include’和`-imacros’选项按书写顺序处理. -imacros file 在处理常规输入文件之前,首先处理文件file,但是忽略输出结果.由于丢弃了文件file的 输出内容, -imacrosfile'选项的唯一效果就是使

枫潇潇 3万+

强化学习——day16 动态规划算法

动态规划(dynamic programming)是程序设计算法中非常重要的内容,能够高效解决一些经典问题,例如背包问题和最短路径规划。动态规划的基本思想是将待求解问题分解成若干个子问题,先求解子问题,然后从这些子问题的解得到目标问题的解。动态规划会保存已解决的子问题的答案,在求解目标问题的过程中,需要这些子问题答案时就可以直接利用,避免重复计算。本章介绍如何用动态规划的思想来求解在马尔可夫决策过程中的最优策略

想太多的学习日志 1551

【UE5 C++开发指南】从零配置Visual Studio 2022开发环境

本文详细指导如何从零开始为UE5 C++开发配置Visual Studio 2022环境。文章强调了VS2022与UE5的深度兼容性,并逐步讲解了社区版下载、核心工作负载(如“使用C++的游戏开发”)与组件安装、界面优化、专属工具设置以及首个C++项目的创建与验证流程,帮助开发者高效搭建专业开发环境。

weixin_29016865的博客 395

Event Logging 技术简介

1.     EVENT LOGGING概述       当错误发生时,系统管理员或技术支持需要知道错误原因是什么,如何恢复丢失数据和阻止错误复现。WINDOWS的Event-logging服务为此提供了解决方案。应用程序,操作系统或其它系统服务可以向该服务记录重要的事件消息,如:磁盘空间不足、没有访问权限等。系统管理员可以通过这些消息来确定错误发生的原因以及发生的上下文环境。通过定期的查看这

colorknight的专栏 1万+

Cursor自动生成测试用例

或者把你已有的规则直接复制粘贴到这个文档内(这里我用的是Markdown格式和CSV格式的测试用例生成规则,可以同时生成Markdown和CSV格式的测试用例)。在AI对话框这里,我们可以看到Cursor会逐步来帮我们生成测试用例,先分析识别需求文档,然后生成测试用例,最后会进行质量检查,确保生成的用例符合规范。生成的Markdown格式,可直接导入Xmind,生成思维导图,对应到具体的功能模块看具体的测试点,逻辑会更直观一些。(1)选中规则文档和需求文档:@你的测试用例规则文档@你的需求文档。

十二测试录 2433

告别图形界面:掌握这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

大学生作业:80C51存储器数据传输实验:基本指令和数据传送

大学生作业:80C51存储器数据传输实验,报价 200 文章目录实验一、80C51存储器数据传输实验实验目的:实验内容一:基本指令实验内容二:数据传送 实验一、80C51存储器数据传输实验 实验目的: 熟悉软件的集成开发环境 掌握单片机软件设计流程,掌握存储器结构及各窗口之间的联系 掌握内部数据存储器、外部数据存储器的数据传送特点和应用; 实验内容一:基本指令 用三种方法实现将累加器A内容改为20H ORG 0000H LJMP MAIN ORG 0030H MAIN: ;方法一使用寄

weixin_54707168的博客 5115

把 ST03 的历史数据留得更久:ABAP Workload 统计保留期设置、原理与落地避坑指南

SAP ST03性能数据保留期配置指南 ST03/ST03N是SAP系统性能分析的核心工具,但默认数据保留期通常较短(3个月左右),难以满足跨季度对比、年度规划等需求。本文详细解析了ST03数据保留期的配置方法及注意事项: 数据存储机制:性能数据存储在监控库中,通过定期重组作业清理过期数据 配置路径:7.0+系统在"Workload Collector Database→Reorganization→Control"中按Profile分别设置 关键限制:保留期最大值建议不超过99,否则可

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 219

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

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

2501_92125808的博客 340

手把手教你学Simulink——逆变器场景:基于PR控制器的单相逆变器并网控制策略仿真

摘要:本文详细介绍基于PR控制器的单相逆变器并网控制策略的Simulink仿真实现。首先分析PR控制器在单相逆变应用中的优势,然后逐步讲解模型搭建过程,包括主电路设计(直流电源、全桥逆变器、L滤波器)、控制回路实现(参考电流生成、坐标变换、PR控制器设计)以及关键参数设置。通过仿真验证了PR控制器对电网频率的精确跟踪能力,并网电流THD<3%。最后提出优化建议,如加入状态观测器、自适应参数整定等改进方向。该建模方法为可再生能源系统中的逆变器控制提供了有效验证手段。

MHD0815的博客 497

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

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

freeking101的博客 1万+

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

ssm框架搭建

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

服务器统一命名规范

将lqs更新为optmv_sci2_user02。

hezhensheng007的专栏 240

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

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

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

weixin_34072637的博客 428

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

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

weixin_34126557的博客 1018

数据库——MySQL

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

qq_46518480的博客 418

Perl Underground 5

  $$$$$$$$$ $$$$$$$$$$$ $$$$$$$$$ $$$$ %%%%%%%% X x $$$$$$$$$$$ $$$$$$$$$$$ $$$$$$$$$$$ $$$$ %%%%%%%% x H H $$

1万+

WINDOWS下使用EXPECT的简单例子

这是一个自动登录AIX服务器的例子。 1、先去如下地方下载expect:windows">http://expect.nist.gov/#windowsftp://bmrc.berkeley.edu/pub/winnt/tcltk/expect2、安装默认路径是C:Program FilesExpect-5.21binexpect.exe就在这里3、写个简单的脚本sample.tx

8297

crt应用脚本一例子,windows下的expect

日常工作有大量cisco路由器,交换机设备备份,telnet设备需要通过其一台服务器(solaris系统)进入,因网络关系无法通过TFTP完成备份.因此程序通过crt软件脚本实现.作:gyhong# $language = "VBScript"# $interface = "1.0"Cnstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb

3058

Dvbbs 8.2 login_sql注入漏洞探析

挺无聊的,分析下”洞网/”,环境架好后.找到有问题的语句:       End If       Else              username=trim(Dvbbs.CheckStr(request("username")))              If ajaxPro Then username = unescape(username)       End If

2945

编程通过WMI获取系统信息

 要了解WMI,请查阅:http://www.microsoft.com/china/technet/community/scriptcenter/resources/wmifaq.mspx#EJC 。       WMI是一组COM对象,其接口比较多,详细请参考:http://msdn.microsoft.com/library/default.asp?url=/library/

2748
上一篇: 控制台下输出DLL的调试信息
下一篇: pragma指令简介
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值