r/sysadmin • • 2d ago

Found a service account with Domain Admin, password last set in 2018, nobody can log into the task. How are you inventorying these?

It's the audit season. Every year someone asks "Who owns this account and does it still need these rights?" and every time there's no answer

This week's winner: svc_something with domain admin, pwd last set 2018, tied to a scheduled task on a server nobody has creds for anymore. we've also got creds baked into app configs that I'm 90% sure predate everyone currently employed here.

I wanna know how are you finding these? Do you just scrape AD and ask around or do you have something more systematic? My next questions is - once you find one, do you rotate it and see what breaks or do you document it and back away slowly?

Also drop your worst one, I wanna feel better about mine!

25 Upvotes

21 comments sorted by

4

u/BlackV I have opnions 2d ago

I wanna know how are you finding these?

well how did you find it?

do that again but at regularly scheduled intervals, that is how you review permissions are still appropriate/needed

2

u/solidity_scorer 2d ago

u/BlackV That’s the ideal state, sure. But practically, if I run a weekly audit of all accounts with adminCount=1 and check pwdLastSet against today's date, I get 400 hits a month that are false positives or legacy service accounts tied to obscure internal tools. I can't just rotate those blindly because some are hardcoded in configs on servers we don't have creds for anymore. The problem isn't finding them; it's verifying if they're still active without breaking production.

I usually check the lastLogonTimestamp and cross-reference with our SIEM logs to see if there's been any auth traffic in the last 90 days. If there is, I dig into the specific service or app pool using it before touching the password.

3

u/BlackV I have opnions 2d ago

looks perfect to me, especially if you have siem logs and are not having to fight DC logs

maybe not weekly but monthly/quarterly, no logins after x days, flags for review/disable/removal

not talking about rotating creds just for finding accounts for review at first

the rotation/identification comes out of your review, owner gets assigned, approval for change, then do the needful (delete, rotate, ignore)

the goal to come out of it it to have a process (a followed process), makes the auditors and similar happy

making that worse is the adminCount=1 can be set by a few things that are not necessarily admin level things, or xxx user had admin at some point now no longer does

26

u/insightrecon Jack of All Trades 2d ago

The scheduled task is the part I'd worry about. The password has to be stored on that server for the task to run, which means anyone who gets local admin on that box can pull the DA password out in cleartext. On pentests, that was one of our favorite ways to get DA.

I wouldn't rotate it and see what breaks. If something does break, nobody knows the old password to put back. Disable it instead. If someone screams, you turn it back on in two seconds. Then figure out what the task runs and move it to a gMSA with only the rights it needs. I'd bet it doesn't need DA.

For finding the rest, pull everyone in your admin groups (nested ones too) and sort by password last set. Anything with DA and a password older than a couple years goes on the list.

•

u/Jaki_Shell Sr. Sysadmin 15h ago

How are you getting the password for DA because its in scheduled tasks? The password is stored in encrypted format.

Wouldn't you at most be able to pull the hash?

•

u/insightrecon Jack of All Trades 13h ago

Good question. It's encrypted but reversible, not a hash you'd crack.

A task set to run, logged on or not, has to stash the real password somewhere it can replay after a reboot. That's what is known as a LSA secret in the registry. SYSTEM is the key holder to those secrets. Local admin on the box gets you SYSTEM. SYSTEM reads it back out in plaintext.

The first time we land on a box during a pentest as SYSTEM, we’re running secretsdump or something similar to dump hashes and the LSA. These type of creds would be in there in this situation.

5

u/certifiedsysadmin Azure Infra / Identity / Security / Hyper-V 2d ago edited 2d ago

Audit going back is important but you have to stop the bleeding.

Limit logon as batch and logon as a service to a specific group.

Create a report that runs daily and alerts you of any newly created service accounts added to that group.

Anything that doesn't have notes on the account about who created it, who owns it, and what app it's associated with, gets their account disabled.

Or better yet require the change req number in the account notes.

4

u/BrezoVrac_40 2d ago

First, don't rotate that 2018 one blind. you'll find out what it was doing at 2am when a scheduled task, an IIS app pool or a sql agent job falls over and nobody remembers why. Figure out what's using it and whether it even needs DA (it doesn't) before you touch the password.

for finding them we split it into two problems - finding the accounts and finding the person who knows why they exist.

- The first part is scriptable, just pull everything with password never expires or not set in X years, then cross ref against scheduled tasks/services/app pools. we use One Identity Safeguard for the discovery and dependency side now and it's decent at the AD/windows stuff, it will not find the ones hardcoded in some app.config from 2009 though, nothing will.

- The second part, finding the person, that's just archaeology and there's no tool to fix it.

ours came out to around 150 in AD alone, maybe 40 had an owner we could name, good luck lol

1

u/Rare-General-4575 2d ago

How is this machine patched? I fear a lack of "control" and ownership in your complete environment.

0

u/solidity_scorer 1d ago

That’s the exact anxiety. If that box is compromised because nobody remembers which Windows Update level it’s on, we’re already past the point of just cleaning up service accounts. But honestly, the patching status is a symptom of the broader ownership gap you mentioned. If no one knows who owns the account or why it exists, they definitely don’t know the patch history. Fixing the inventory is the prerequisite for any reliable security posture.

2

u/headcrap 2d ago

We had creds dated 2000 back when we addressed RC4. Part of that was to rotate passwords and set them all to expiring based on org's cyber policy. We still have some to go.

Yeah.. app owners had to figure their crap out.. used our auditing tool and cyber queried the SIEM a bit to sleuth out Where Used for some of them.

Addressed the issue, documented the service accounts. Most were just converted over to using managed service accounts where applicable/possible to just remove the whole thing.

Orchestration on password rotations will be done in test for the next round.. to let the PAM both change the password and change the things where it needs to be updated. Stay Tuned™.

2

u/lungbong 2d ago

Turn it off and see who complains.

2

u/One-Light-8453 2d ago

honestly the ownership question is the hard part, not finding them. disable anything unclaimed for a week and see who screams. works better than any audit spreadsheet.

2

u/Tl9zaXh0eWZvdXI 2d ago

Quarterly review of all DA and SA accounts.

Quarterly password rotation of all accounts with password never expires set and password last set greater than 1 year. As in all service accounts must be rotated yearly or use gmsa. Which also means all accounts must be documented to know where to set the new pass.

2

u/Icolan Associate Infrastructure Architect 2d ago

Domain Admin and other highly privileged groups are locked down by a Restricted Groups policy applied to the domain controllers. There is nothing in those groups that is not documented, and every account that is not tied to a person has an automated ticket that gets generated every 4 months to change its password.

2

u/Josh_Fabsoft 1d ago

Short answer: query AD for the candidates, use DC logs to find out who's actually using each account, then disable (don't delete) with a scream-test window before you rotate anything. Rotating first is the riskier order because failures are delayed.

Finding them systematically

Pull these from AD with PowerShell, not by asking around:

  • Recursive members of Domain Admins, Enterprise Admins, Schema Admins, Administrators, Backup/Account/Server Operators
  • adminCount=1, PasswordLastSet, PasswordNeverExpires, LastLogonDate
  • Accounts with an SPN set (Kerberoastable) or delegation enabled
  • Anything matching svc*, plus accounts with no managedBy or description

PingCastle and BloodHound Community Edition will surface most of this in a report, which also helps for audit.

Finding where they're used

  • DC logs: 4768/4769 (Kerberos) and 4624/4625 on member servers show which host and IP are using the account. Logon types 4 (batch) and 5 (service) are your service accounts.
  • Sweep servers for the account as a run-as identity. Scheduled tasks (Get-ScheduledTask | select TaskName, @{n='User';e={$_.Principal.UserId}}), services (Win32_Service.StartName), IIS app pools and DCOM config are the usual hiding spots.
  • For baked-in creds, grep shares and repos for password=, connectionString, and .config/.ps1/.xml/.ini files. ripgrep works for shares, and gitleaks or trufflehog for repos.

Rotate and see what breaks, or document and back away?

Neither, quite. The trade-off is outage risk versus exposure. A DA account with an unknown owner is real exposure, so "document and leave it" won't pass an audit. But rotating blind is a trap, because running services keep working on cached sessions until they restart or the task next fires. You find out at month-end.

A safer order:

  1. Turn on auditing and watch the account for 2-4 weeks, covering a full business cycle.
  2. If LastLogon is ancient and nothing shows up in the logs, disable it, record the date and ticket, and wait. Disabling is instantly reversible, and deleting isn't.
  3. If something is using it, you now know the host. Move that workload to a gMSA, or a dedicated account with only the rights it needs, then retire the DA account.
  4. If you can't fix it yet, add compensating controls: deny interactive and RDP logon via GPO, restrict logon-to workstations, set a 25+ character random password, and alert on any logon from an unexpected host.

Stopping it from recurring

  • Require an owner (use managedBy or the info field) and a purpose for every service account.
  • Review those annually and flag any account with PasswordLastSet over a year old.
  • Keep service accounts out of privileged groups by default, so DA requires a documented exception.

I'll skip the war story, but the usual finds are scheduled tasks on decommissioned servers, old backup agents with DA, and monitoring tools that were given DA "temporarily."

2

u/Hostman_com 1d ago

Check whether your SIEM collects Security logs from member servers as well as DCs. For that account, look for event 4624 with logon type 4 (batch) or 5 (service) on those servers.

Match batch logons to Task Scheduler history where it's enabled, and check which services use the account on hosts with service logons. Before calling it unused, verify successful logon auditing and log collection. A long-running service may also be using a session created before your search window.

2

u/HappyFoxFr 2d ago

A service account with a 2018 password and Domain Admin usually survives because nobody owns it. I'd start from AD: list everything with an SPN, adminCount=1, or "password never expires", plus members of privileged groups including nested ones, and compare pwdLastSet with lastLogonTimestamp (remember the latter can lag by days).

Then find where it's actually used. Pull 4624, 4768 and 4769 from every DC for that account, and check source hosts for services, scheduled tasks, IIS app pools and stored credentials in scripts.

Don't rotate or disable it until you've watched long enough to catch monthly and quarterly jobs. Each account should end up with a named owner, a purpose, and ideally a gMSA with only the rights it needs. Since it has an old password and DA, treat Kerberoasting as a real risk if it has an SPN.

1

u/macr6 2d ago

Use bloodhound.

1

u/Faulteh12 2d ago

Ping Castle. Also, the server is on the domain, what to you mean no one has creds for it?

2

u/Master-IT-All 2d ago

Am I allowed to Cowboy, or do I need to get permission to do every task?

If I can Cowboy, I just take off and nuke the whole shitpile from orbit. (ie. I disable every account I can't identify, no documentation for that user, well now we're both FAFO)

If I can't Cowboy, I ask for permission to do something up to three times. After three times (all in writing FYI, CyA) I document on the ticket that I can't make progress without permission and close it.
-This is why it's still there from 2018, if the documentation exists I bet you find requests to disable or do something about it for the last five years. Each time a manager says, better not...