-
Notifications
You must be signed in to change notification settings - Fork 284
AAD report error due to invalid JSON result #1607
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
Comments
Hey @Strawberryww, thanks for reporting this issue. We have replicated the bug and are looking into a fix. Are you seeing any results for the |
@mitchelbaker-cisa Thanks. Yes, there is result for the |
I created a new branch that adds additional error handling to the Do you mind downloading a zip of the new branch to test out the fix? It can be found here: After importing it in a new PowerShell terminal, run |
@mitchelbaker-cisa Thanks for your analysis. I've tried the fix with
![]() There is value for ![]() I've double checked that the code ![]() Is there any way to save the output to a file before converting to JSON? Then, it's better for analysis. That is:
Thanks. |
Hey @Strawberryww, thanks for testing out the new branch and providing these additional details. We've determined there are four cases that occur regarding risky application/service principal data:
The issue occurs in the last case, "risky apps exist but no risky 3rd party SPs exist." We're still working on a fix but will message here when it's ready. Regarding your question on saving the output to a file before converting to JSON, you can add |
@mitchelbaker-cisa Thanks for you detailed explanation. I'll try to save the JSON result and check whether there is any clue. |
Following. I'm running into the same bug :(. Tested the new branch just to see what would happen and still failed. |
Is there a way to disable the third-party apps to get around this error until it is fixed? |
You can override the faulty bit if you edit the file around line 215-216 you'll see the variables If you override those (I added new lines at 218 and 219 after the closing } of the if/else block), adding in and saving the file, then re-running ScubaGear, it will complete and you'll get the results for everything other than the RiskyApps. |
Following here as well. Same bug, same issue, verbiage is the same as posted by @Strawberryww tried editing exportaadprovider.psm1 per @TheArchimedez still no joy. if i remove aad from the -productname everything runs like a champ |
another workaround, but not pretty and only serves to test out v 1.5 is to remark out and remove the following out of exportaadprovider.psm1 Remark out
Remove
if you do that, tool will run aad report |
Ahh I see the issue with your implementation of my workaround, the
Should have been below the last } of the if else blocks, apologies for not making that clear. But yes, your solution is doing essentially the same thing. More than one way to skin a cat ;) |
Thanks @TheArchimedez for the confirmation @mitchelbaker-cisa i'm currently working with an organization that BOD 25-01 applies to. Since remediation is required by 20-June do we have a timeframe on when this will be resolved ? we were running 1.4 but since 1.5 is current release i thought i would upgrade and go from there. any guidance there ? |
Related to identified bug #1658 which breaks out this specific issue with the risky service principals field being null. |
I'm working on getting a fix ASAP, we will most likely release a patch fix to address the issue. |
When you have a chance, please test out the latest changes to this feature branch and let me know if you are able to generate the AAD report successfully. https://github.com/cisagov/ScubaGear/tree/1607-risky-sps-invalid-json |
Can't speak for others, but I seem to still be getting the same error with the patch. Merged the ZIP into a 1.5 installation, imported the Scuba module, and ran all products. |
Thanks for testing, @kickinitlegit. To confirm you reimported ScubaGear with |
Didn't get a chance to check the json. I can confirm that I re-imported, though. I'll try testing in my lab this weekend if someone doesn't get to it first. |
Looks like"risky_applications" populated with objects. I believe "risky_third_party_service_principals" is empty, however. |
@kickinitlegit Do you mind checking if the RiskyPermissions.json file you have locally matches the file in the remote branch? There should be the following number of permission scopes for each node:
|
I'm seeing 37, 2, 13, 5. Should I try re-downloading and re-merging the branch since the numbers don't match up? EDIT: After looking, I'm seeing the same number and same permissions in mine as in the remote branch. Ignore the above. |
I must have miscounted, confirming the totals are 37, 2, 13, 5 so no issues here. I added a few improvements to the error handling, could you try redownloading/remerging the branch? |
Remerging with the new error handling seems to work. I no longer got the error shown in the issue highlighted. Any files you need me to check? |
Ok great. If there were no errors then in the output directory do you have a
|
🐛 Summary
When using ScubaGear 1.5.0 to scan AAD, it reports the following error:
To reproduce
My Azure tenant can always reproduces the error, but another tenant is OK.
The invoke command is as below:
Env:
ScubaGear: 1.5.0
Powershell: 5.1.19041.5369
Windows 10 Pro: 10.0.19045 N/A Build 19045
Expected behavior
There should be no such error.
Any helpful log output or screenshots
The generated JSON result is as below:
The
risky_third_party_service_principals
field is missing its value.Possibly the error is related to the following code in
PowerShell/ScubaGear/Modules/Providers/ExportAADProvider.psm1
:Error in PowerShell:
The text was updated successfully, but these errors were encountered: