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

Error with TFA and non API account #1

Open
posh-man opened this issue Jul 6, 2021 · 2 comments
Open

Error with TFA and non API account #1

posh-man opened this issue Jul 6, 2021 · 2 comments
Assignees

Comments

@posh-man
Copy link
Collaborator

posh-man commented Jul 6, 2021

Describe the bug
It looks like the Cybereason API will not work with a TFA account, and the account used must be an API account.

To Reproduce
I added the following code to the Connect-CybereasonAPI function:
[Parameter(
Position=4,
Mandatory=$true,
ValueFromPipeline=$False, # End Parameter
HelpMessage="`n[H] Enter the code on your google authenticator")]
[String]$Authenticator,

I then added the following code to the same function

$Body = @{
username="$Username"
password="$Passwd"
totpCode="$Authenticator"
}

This produces a result of:

[*] Successfully created an authenticated session to the Cybereason API.

However any other functions produce the following error:
ConvertFrom-Json : Invalid JSON primitive: .
At line:12 char:29
$Response.Content | ConvertFrom-Json | ForEach-Object {
~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

The only exception to this behavior is the Get-CybereasonThreatIntel function.

Expected behavior
It would be nice to be able to have TFA to access these API's and not be required to use an API account. For automation it is clear that TFA is not going to work; however, for single use case or manned scripting TFA should be available.

**Desktop **

  • OS: Windows 10

Additional Considerations
The API from Cybereason seems to have the ability to take TFA, so this may be a simple fix of adding in the functionality.

@tobor88 tobor88 self-assigned this Jul 6, 2021
@tobor88
Copy link
Owner

tobor88 commented Jul 6, 2021

Thanks @posh-man! for the issue request!
I have added your additions and some other appropriate changes into the cmdlet for "Connect-CybereasonAPI" and made a note of the specifics in it's help section. I will update the README as well with this and the below information.

The reason for this issue has to do with the Cybereason API. I am going to leave this open in case they ever update this as a reminder for myself to check every so often.

DETAILED EXPLANATION
Cybereason has two permission types that can communicate with the API. There is an API user which needs to be created manually and a GUI User. A user who has the ability to sign into the Cybereason Web GUI can perform queries against the main Cybereason API site. This is their https://sage.cybereason.com/rest/* site. That same user however is not able to perform queries that for example affect isolation rules or other Malop related tasks. These queries get performed against your organizations Cybereason server https://organization-code.cybereason.com/rest/*. (This URL value would be whatever value you enter into the -Server switch parameter in the Connect-CybereasonAPI cmdlet). Only the created API user, who does not have permissions to sign into the Cybereason Web GUI, is able to perform actions dealing with Malops and Isolation rules.

@tobor88
Copy link
Owner

tobor88 commented Jul 7, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants