Interpreting the NT Security Log - Use the Security Log to track user's activities

Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

By R. Franklin Smith

winmag

In "The NT Security Log," March 2000, I explained the Security Log in general terms and gave you some tips about how to configure the Security Log to preserve valuable audit trails. You also need to understand the Security Log and three of the most important auditing categories of security events: logon and logoff, File and Object Access, and Process Tracking. These three categories provide crucial information that you can use to track your users' actions. Each system has an audit policy defined in the Start Menu's Programs, Administrative Tools, User Manager, Policies, Audit, Audit Policy dialog box, which Screen 1 shows. The Audit Policy dialog box dictates which of seven categories of audit events the local Security Log will record.

Cc751315.usesec01(en-us,TechNet.10).gif

Audit Policy

On This Page

Logon and Logoff
Object Access
Process Tracking

Logon and Logoff

Logon and logoff are key events that many administrators consult the Security Log to view, but interpreting this seemingly simple category of audit events can be difficult. First, let's look at the various characteristics of logons. Successful logons have event ID 528, which Figure 1 shows. No failed logons have event ID 528 because failed logons have respective event IDs that are dependent on the reason for the failure. (For a complete list of security event descriptions, see the Microsoft article "Security Event Descriptions" at https://support.microsoft.com/default.aspx?scid=KB;en-us;174074&sd=tech. ) Event ID 538 denotes event ID 528's corresponding logoff event. Event ID 528 provides several important pieces of information in the description field of the event record. User Name and Domain specify which user logged on or the account that the user used. Logon ID is an ID code that is unique to that system and identifies the logon session. You can use the Logon ID to find the corresponding logoff events. You can use a logon event, event ID 528, and its corresponding logoff event, event ID 538, to determine the duration of a user session.

Figure 1: Event ID 528

Successful Logon:

 

User Name:

administrator

Domain:

DOMAIN

Logon ID:

0x0,0x9B2214)

Logon Type:

3

Logon Process:

KSecDD

Authentication Package:

MICROSOFT_AUTHENTICATION_PACKAGE_V1_0

Workstation Name:

\\TECRA

The logon event description also shows the Logon Type, which identifies how the user logged on. When a user logs on at the local console (i.e., keyboard and monitor), the Logon Type is type 2, which is an interactive logon. When a user on a workstation maps a drive or otherwise connects to another network computer, the user performs a type 3 logon, which is a network logon. Therefore, when you see event ID 528, type 2, you know someone logged on at the local console of that computer, and when you see type 3, you know someone connected to that system from the network. When a service starts under its specified user account, Windows NT records a type 5 logon, which is a service logon. If you use a third-party batch queue facility, such as Argent Queue Manager, the batch scheduler runs your batch jobs under the specified account and NT records event ID 528 with a type 4 logon, which is a batch job logon. You'll also see event ID 528 and event ID 538 with a type 7 logon when someone unlocks a workstation.

Logons can fail for several reasons. So, what happens when logons fail? Most frequently, you see the Logon Failure explanation Unknown user name or bad password, which is event ID 529. If a user has a disabled account or an account lockout, the user's logon fails and the system logs event ID 531 and event ID 539, respectively. Event ID 530 shows that a user tried to log on outside the allowed time of day or day of week periods specified for that user account. If an account has reached its account expiration date or if a user's password expired, the system logs event ID 532 or event ID 535, respectively. If you select the User May Log On To These Workstations option in the Logon Workstations dialog box, which Screen 2 shows, to restrict a user to certain workstations, and the user tries to violate this restriction, NT records event ID 533. You can use rights to restrict users to certain types of logons for certain systems. If a user doesn't have rights to access a certain computer from the network, and the user tries to map a drive to that system or view the Registry, the logon will fail and the system will log event ID 534. Event ID 534 also occurs when a user tries to log on at the console and doesn't have rights to log on locally. Services that use an account without the Logon as a service advanced rights to try to start and processes that use an account without Logon as a batch job advanced rights to try to log on as a batch job also trigger event ID 534. If a logon fails for some other reason, you'll see event ID 537 with the Logon Failure explanation An unexpected error occurred during logon. These failed logon events also provide Logon Type information. For more information about performing audits of logons, see the Microsoft article "Auditing User Authentication" at https://support.microsoft.com/default.aspx?scid=KB;en-us;174073&sd=tech.

Cc751315.usesec02(en-us,TechNet.10).gif

Logon Workstation

In "The NT Security Log," I explained the distributed nature of NT logging. Nowhere does this distribution affect you more than with logon and logoff. People often refer to the act of logging on to a workstation with a domain account as logging on to the domain, but at no time do you log on to the domain, nor do you log on to the domain controller when you use a domain account. Your workstation logon means that you're logging onto the workstation. Because you're using a domain account, the workstation can't authenticate you. Therefore, the workstation uses the NT LAN Manager (NTLM) network authentication protocol to forward your credentials to the domain controller. (For more information about the NTLM protocol, see "Inside SP4 NTLMv2 Security Enhancements," September 1999.) After verifying that your password is correct, the domain controller forgets about you. The workstation maintains your logon session until you log off. Consequently, the workstation's Security Log records interactive logons.

So, how do you get a picture of your domain's overall logon activity without looking at the Security Log of every workstation? Usually a user's logon script performs standard drive mappings to file servers immediately upon logon, so many administrators examine their file-server Security Logs for events with a type 3 logon. Because no central record of logon activity for the domain exists, monitoring intrusion attempts is difficult. However, some help is available. Although domain controllers don't record all failed logons, they record all account lockouts, event ID 644, that are the result of several failed logons in close proximity. For more information about account lockout events, see the Microsoft article, "Account Lockout Event also Stored in Security Event Log on Domain Controller," at https://support.microsoft.com/default.aspx?scid=KB;en-us;182918&sd=tech.

Local accounts also create the need for you to monitor logon activity on individual systems. Although each workstation and server belongs to a domain and primarily relies on the domain controllers for authentication, each workstation and member server also maintains a local SAM. Users and intruders can use local accounts to try to log on locally or connect over the network. The built-in Administrator account is always present and available for logon. For tips about protecting this account, see "Protect Administrator Privileges," February 2000.

You can effectively monitor logons and logoffs if you know what to look for and where to look. To track logon activity, look (primarily on servers and workstations rather than domain controllers) for logons with event ID 528 and the corresponding logoffs with event ID 538. To watch for possible intrusion attempts, look for events that range from event ID 529 to 537 and event ID 539 on each vulnerable system.

Object Access

The object access category has only three events but is very powerful because it lets you monitor access to any object in your system including directories, files, printers, and Registry keys. In User Manager, you must enable File and Object Access auditing for the system and each object you want to monitor. You specify an object's audit control list similar to the way you specify an object's ACL. The object's audit control list specifies the users and the types of access that you want to track.

Object access auditing is an event log not a transaction log. Therefore, NT doesn't tell you what the user did to the object, but the type of access the user used to open the object. For example, you can see an event that shows John opened salary.xls for Read, Write, Execute, and Delete access, but the event doesn't tell you whether John changed the file, and if so, the changes he made. Another caveat when auditing object access is that one user action can result in many events in the Security Log. For example, selecting a text file with Windows Explorer and double-clicking the file to view it in WordPad produces more than 20 events when auditing all access for that file and its parent directory.

Object auditing is most useful with conventional applications that directly use individual files, such as Microsoft Office applications. Other client/server applications, such as SAP, store all their data tables in a few large Microsoft SQL Server database files. If you enable auditing for these files, you ordinarily see the open and close of objects when the database server starts and stops. You can't determine which user is executing transactions or making modifications or the tables he or she is modifying. You have to rely on the application to provide that information. However, one reason to audit those monolithic database server files is to catch someone modifying them outside of the application. With most database servers, including SQL Server, you can shut down the service, replace the database files with another file version, and start the service again without the database server detecting the action. You might catch tampering of this nature with object access auditing.

The two main events of object access are object opened, event ID 560, and handle closed, event ID 562. These two events are complementary, similar to the logon and logoff events. Successful event ID 560 events, which Figure 2 shows, display the opened object, the user that opened the object, the program the user used, and the user's level of access. Before a program can access an object, the program must open it, specify the type of access it wants, and obtain a Handle ID. A Handle ID is a number that the OS uses to track open objects. The Handle ID is similar to the Logon ID. You can use the Handle ID to link an opened object event (event ID 560) to its corresponding handle closed event (event ID 562) to determine the length of time the user had the object open. The Handle ID also shows up in the event description, which Figure 2 shows, so you can identify the logon session the user accessed this object in.

Figure 2: Event ID 560

Object Open:

 

Object Server:

Security

Object Type:

File

Object Name:

D:\arc

New Handle ID:

1284

Operation ID:

{0,10166860}

Process ID:

2161439552

Primary User Name:

SYSTEM

Primary Domain:

NT AUTHORITY

Primary Logon ID:

(0x0,0x3E7)

Client User Name:

administrator

Client Domain:

DOMAIN

Client Logon ID:

(0x0,0x9B2214)

Accesses:

ReadData (or ListDirectory)

The event description specifies two users: primary and client. If you use a conventional application (e.g., Microsoft Word) to open a file on your local system, the primary user information is the only relevant item. However, if you access an object through a client/server application that uses OS-level impersonation, the primary user information identifies the user account of the server application, and the client user information reflects the user on whose behalf the server is acting. A common example of this scenario is NT's handling of file sharing. When you access a file on a computer across the network through a shared directory, your local workstation service connects to the server service on the other system and initiates a type 3 logon. Before processing any request, the server impersonates the remote user and causes object access events to record both primary and client user information. In this case, the Primary User Name is SYSTEM, which is the account the server service runs under. The Client User Name matches whomever the client connected to the file server as and is ordinarily his or her domain account.

The Accesses field in event ID 560's description tells you which type or types of access the user used to open the object. The values for the access types correspond to low-level permissions in ACLs. For example, when I change a text file with WordPad, NT logs event ID 560 with accesses such as ReadData, WriteData, and AppendData.

A final piece of important information in event ID 560's description is the Process ID. You can use the Process ID to determine the program that the user accessed the file with. You can link the Process ID to other events to determine whether a user used Word, WordPad, or Notepad to change a file, which I discuss later. However, the Process ID is useful only when the accessed object is on the same system as the user accessing the object. Otherwise, such as in the case of a file-server scenario, the Process ID will correspond to the server application and doesn't reveal much information.

The other important event in the File and Object Access category is object deleted, event ID 564. Event ID 564 specifies only the Handle ID and Process ID. To determine the user and the object the user deleted, you must use the Handle ID to link the object deletion event (event ID 564) to the corresponding object opened event (event ID 560). The object opened event tells you which user opened the object with delete access, and the corresponding object deleted event confirms the user deleted the object.

Object access auditing is powerful but can be laborious and has the potential to slow down your system performance depending on how many objects you audit and how heavy activity is on those objects. I recommend that you use object access auditing sparingly. Aside from protecting highly important resources, security personnel often use object access auditing to build evidence when they suspect a user is tampering with data. I've also seen administrators enable object auditing on decoy files, such as a dummy salary.xls file, to catch would-be perpetrators. However, you need to consider propriety concerns before you use this approach. Don't forget that you need to enable object auditing in User Manager on the system in which the objects in question reside to log access events—not necessarily on the user's local workstation.

Process Tracking

The User Manager uses the term process tracking, but NT Event Viewer and NT documentation commonly refer to this category as detailed tracking. This category lets you track which programs a user is running on a workstation and which programs the server is using. Like the other categories, this category specifies two main events: creating a new process, event ID 592, and exiting a process, event ID 593. You can use the Process ID field common to both events to link the process creation (event ID 592) to its corresponding exit (event ID 593) and determine how long the program ran. The Image File Name field tells you which executable the user opened. For example, if you run WordPad, you'll see WORDPAD.EXE in the Image File Name field, as Figure 3 shows. Unfortunately, you don't know which program ran because the field doesn't include the directory path. The User Name field specifies who ran the program, and you can link the Logon ID in event ID 592's description to the corresponding logon (event ID 528) to determine which logon session the program ran. In unusual situations in which you want to discover which program is running another program, you can link the Creator Process ID to its corresponding process start (event ID 592).

Figure 3: Event ID 592

A new process has been created:

 

New Process ID:

2154954240

Image File Name:

WORDPAD.EXE

Creator Process ID:

2158910656

User Name:

Administrator

Domain:

DOMAIN

Logon ID:

(0x0,0x5Ce9)

Process tracking can be very useful on workstations, especially when you're investigating a user's activity. Process tracking combined with object access auditing on servers will give you a clear picture of a user's actions.

Logon and logoff, object access, and process tracking are three important categories of the NT Security Log. You can link logon sessions, processes, and object accesses to closely track a user's activity, as Figure 4 shows. Unfortunately, Event Viewer can't filter based on values in the description field; consequently, using the Logon ID, Process ID, or Handle ID to link events is laborious. However, the Event Viewer's Find dialog box lets you search the description field, which can help you link events in a pinch. You can also use event-log utilities to help you with problems such as filtering the Security Log.

When determining your audit policy for these categories, keep in mind how computer roles (workstation, server, and domain controller) affect the destination directory in which the system logs the events. Be careful with object access and process tracking because these two categories are the most likely to cause performance problems. In my next article in this series, I'll discuss more categories such as account management, policy change, privilege use, and system events.

[Editor's Note: Email the author information about your favorite event-log tools (preferably shareware), and he'll put together a tour of the best tools that administrators are using. Send him your tips about how to get the most out of your NT Security Log.]

ABOUT THE AUTHOR

R. Franklin Smith, president of Monterey Technology Group, provides Windows NT security training and consulting. You can reach him at mailto.

Link
Click to Order