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系统 阅读详情

相关推荐

Crossformer实战:从零开始搭建多变量时间序列预测模型(附ETTh1数据集调参指南)

本文提供了从零开始搭建Crossformer多变量时间序列预测模型的实战指南,并附有详细的ETTh1数据集调参攻略。文章深入解析了Crossformer的核心设计,重点探讨了seg_len和win_size等关键参数对模型性能的影响,并分享了环境配置、训练调试及常见问题的解决方案,帮助开发者高效应用这一前沿深度学习模型。

weixin_29281915的博客 321

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

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

culuo8053的博客 516

pdf.js 移动端手势缩放功能实现与原生事件集成

本文详细解析了如何为pdf.js的viewer.html移动端页面实现流畅的双指捏合手势缩放功能。通过深入分析pdf.js的缩放机制,并利用原生触摸事件(touchstart、touchmove、touchend)进行集成,在不修改核心源码的前提下,为用户提供媲美原生应用的顺滑缩放体验,有效提升了移动端PDF阅读的专业性和用户满意度。

brandy的博客 490

GCC编译选项参数

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

枫潇潇 3万+

一文搞定 GitHub SSH Key:生成、配置、好处全攻略

本文详细介绍了如何配置GitHub SSH Key,实现免密安全认证。主要内容包括:SSH协议的四大优势(免密登录、安全性高、稳定省心、支持自动化);Git身份配置步骤;检查本地SSH Key;生成RSA密钥对;添加密钥到SSH代理;复制公钥到GitHub;测试连接。配置完成后,开发者可通过SSH地址克隆仓库,实现push/pull全程免密操作。该方案显著提升Git使用效率,同时保障安全性,是开发者必备技能。

qq_62904883的博客 959

华为OD技术面真题 - JAVA开发 - 1

汇总华为OD技术面八股JAVA八股,高频技术真题并提供详细解答。

qq_45776114的博客 1206

Event Logging 技术简介

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

colorknight的专栏 1万+

基于Simulink雷达系统建模仿真(附源码)

此示例显示如何设置由发射器、带目标的信道和接收器组成的雷达系统仿真。一、系统架构该系统包括:雷达脉冲发生器,以 2% 占空比(导通时间 = 2 ms,周期 = 100 ms)输出功率为 1 mW 的啁啾声。RF发射器部分由滤波器和组成,使用RF模块集电路包络库模块实现。由于滤波器是线性器件,放大器是非线性器件,因此它们被分成两个独立的子系统。这种分离允许在每个子系统中使用不同的仿真频率集。这种分离还允许在更快的仿真速度和级联链中可用的级间负载效应损失之间进行权衡。

珞瑜的博客 4583

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

34、高效探索柔性蛋白质环构象空间的算法

本文介绍了一种高效探索柔性蛋白质环构象空间的算法,通过种子采样和变形采样两种技术,同时满足运动学闭合和避免空间位阻冲突的约束条件。种子采样能够在闭合无冲突构象空间中广泛生成构象,而变形采样则可以对“有趣”区域进行更密集的探索。实验结果表明,这两种方法在不同大小和受限程度的蛋白质环上均表现出色,运行时间在可接受范围内。相关算法已集成到工具包LoopTK中,可在https://simtk.org/home/looptk获取。

moon9的博客 128

基于STM32、HAL库的ZMOD4510AI4R气体传感器驱动程序设计

ZMOD4510AI4R是Renesas公司推出的一款数字空气质量传感器,主要用于检测臭氧(O₃)和总挥发性有机化合物(TVOC)浓度。(status & 0x80)) // 检查数据就绪位。// 等待测量完成 (实际应用中应该使用非阻塞方式)// 转换为ppb (简化转换,实际应根据传感器文档校准)* @param hzmod: ZMOD4510句柄。* @param tvoc: TVOC浓度(ppb)* @param ozone: 臭氧浓度(ppb)* @param hi2c: I2C句柄。

corlin6688的博客 312

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

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

2501_92125808的博客 340

面经-2023-禾赛-FPGA工程师

面经-2023-禾赛-FPGA工程师

w0shishabi的博客 2970

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

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

freeking101的博客 1万+

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

服务器统一命名规范

将lqs更新为optmv_sci2_user02。

hezhensheng007的专栏 240

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

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

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

weixin_34072637的博客 428

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

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、付费专栏及课程。

余额充值