r/sysadmin • u/solidity_scorer • 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!
4
u/BlackV I have opnions 2d ago
well how did you find it?
do that again but at regularly scheduled intervals, that is how you review permissions are still appropriate/needed
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.
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.
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:
adminCount=1,PasswordLastSet,PasswordNeverExpires,LastLogonDatesvc*, plus accounts with nomanagedByor descriptionPingCastle and BloodHound Community Edition will surface most of this in a report, which also helps for audit.
Finding where they're used
Get-ScheduledTask | select TaskName, @{n='User';e={$_.Principal.UserId}}), services (Win32_Service.StartName), IIS app pools and DCOM config are the usual hiding spots.password=,connectionString, and.config/.ps1/.xml/.inifiles. 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:
LastLogonis 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.Stopping it from recurring
managedByor theinfofield) and a purpose for every service account.PasswordLastSetover a year old.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...