Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discover and Parse Certificate Files for offline analysis #40

Open
joeavanzato opened this issue May 1, 2023 · 4 comments
Open

Discover and Parse Certificate Files for offline analysis #40

joeavanzato opened this issue May 1, 2023 · 4 comments
Labels
detection enhancement New feature or request help wanted Extra attention is needed

Comments

@joeavanzato
Copy link
Owner

Currently we are using PowerShell cmdlets to retrieve this information - need to get the same information from the files directly for use in deadbox analysis.

@joeavanzato joeavanzato added the enhancement New feature or request label May 1, 2023
@baileydauterman
Copy link
Contributor

A note on certificates, whenever certs are being parsed - if there is a PIV/CAC cert tied to the machine it will always popup the authentication menu and will hang the script. I think this issue will fix that problem if we are able to access the cert files directly.

@baileydauterman
Copy link
Contributor

After looking at the function, most likely related to the Test-Certificate call

@joeavanzato
Copy link
Owner Author

Interesting - that is good to know - yes parsing cert files directly would probably help to alleviate that - the regex is a little messy right now and could also be improved - basically I'm pulling CN out of the Issuer/Subject if it exists and O otherwise but there might be a cleaner way to approach this. Is there anyway to detect if the current cert is PIV/CAC-based and skip testing for that one as a temporary solution?

@baileydauterman
Copy link
Contributor

baileydauterman commented May 3, 2023

This regex might be a bit better for parsing the signer out

$certRegex = "CN=(?<cn>.*?),\s+(?:OU=(?:.*?))+,\s+O=(?<signer>.*?),"
foreach ($cert in $certs) {
    if ($cert.Issuer -match $certRegex) {
        $matches["signer"].Trim('"')
    }
    $matches.Clear()
}

@joeavanzato joeavanzato added help wanted Extra attention is needed detection labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detection enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants