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

ModeSic Up to date #7

Open
erfan71 opened this issue Jul 25, 2018 · 22 comments
Open

ModeSic Up to date #7

erfan71 opened this issue Jul 25, 2018 · 22 comments

Comments

@erfan71
Copy link

erfan71 commented Jul 25, 2018

Hi,
it's about one year from the last commit, I want to know that how can I update the database. or is there any alternative for this? I test ModeSIC with oval Schema version 5.11 and it has a lot of errors.
thanks a lot.

@luty81
Copy link
Contributor

luty81 commented Jul 25, 2018

What do you mean is update Oval Schema version ? What kind of error are you facing ? Could you post more details here?

@erfan71
Copy link
Author

erfan71 commented Jul 25, 2018

I downloaded the lastest version of an OVAL file from https://oval.cisecurity.org/repository/download
and when I try to open it with ModeSIC it fails in Schema Validation and says:

Line: 11 Severity: Error Message: The 'http://oval.mitre.org/XMLSchema/oval-common-5:schema_version' element is invalid - The value '5.11.2' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:decimal' - The string '5.11.2' is not a valid Decimal value.
I Try to convert 5.11.2 to 5.11 and this passes this validation, but I get another error that says:
image

It's the link the Oval file that I have tested: LINK
Thank you.

@asoleimanibo
Copy link

I have this problem too
when I import "windows_10_vul-1.zip" its work, but when import "microsoft_windows_10-1" I got this error.
microsoft_windows_10-1.zip
windows_10_vul-1.zip

@surgicalcoder
Copy link

@erfan71 @amirsoleimanii Can you try the fork that I've been updating - https://github.com/surgicalcoder/modSIC ? If you need me to produce binaries, please let me know.

@erfan71
Copy link
Author

erfan71 commented Oct 8, 2018

Thanks for the Update, I successfully Build the solution, But I have a problem with finding the proper certificate for Service and it gets some error. How can I add a certificate for the Service in Visual Studio?

if you get me the builds, I'm very thankful.

@luty81
Copy link
Contributor

luty81 commented Oct 8, 2018 via email

@erfan71
Copy link
Author

erfan71 commented Oct 9, 2018

HI, I create a self-signed certificate and install it in the LocalMachine/My and copy the Thumbprint into the APP.confige file in the Module.colelct.serrvice. after testing the Ovel file, in the "trying to get the result" step it raises an exception:
"System.ServiceModel.FaultException: 'An error occurred while collect execution (see server log for more details): 'The data to be decrypted exceeds the maximum for this modulus of 256 bytes.''

I have searched for this error, But I couldn't find any useful information. I guess is related to RSA and the certificate.
I would be grateful if you help me to fix this problem.
Thanks.

@luty81
Copy link
Contributor

luty81 commented Oct 9, 2018 via email

@erfan71
Copy link
Author

erfan71 commented Oct 11, 2018

Yes, It exactly with these parameters.
Here is the Snapshot. If you want I can export it for you.
image

Thanks a Lot.

@erfan71
Copy link
Author

erfan71 commented Oct 11, 2018

I found the line that causes this bug.

public Credential DecryptCredentialBasedOnCertificateOfServer(byte[] encryptCredential, X509Certificate2 certificate)
        {
            if (encryptCredential == null)
                return new Credential();

            var privateKeyProvider = (RSACryptoServiceProvider)certificate.PrivateKey;
            if (privateKeyProvider == null)
                throw new NoPrivateKeyException();
            //Buggy line.....
            var serializedCredentials = privateKeyProvider.Decrypt(encryptCredential, false);
            //Buggy line....
            var serializedCredentialsAsString = Encoding.Default.GetString(serializedCredentials);

            return JsonConvert.DeserializeObject<Credential>(serializedCredentialsAsString);
        }

it's in the CollectServiceCryptoProvider.cs

@luty81
Copy link
Contributor

luty81 commented Oct 11, 2018 via email

@erfan71
Copy link
Author

erfan71 commented Oct 12, 2018

the length of the array is 470.

@luty81
Copy link
Contributor

luty81 commented Oct 12, 2018 via email

@erfan71
Copy link
Author

erfan71 commented Oct 13, 2018

Both client and server are the ones who @surgicalcoder was told.

@erfan71
Copy link
Author

erfan71 commented Oct 13, 2018

OK, I find the problem, It was an Encoding problem.
My system was in UTF-8 encoding system by default (Encoding for non-Unicode )
I changed all of my setting to English. and it fixed.
I think it's better that you use ASCII encoding instead of default encoding.
And the encryptedCredential was 270 when it fixed.

@erfan71
Copy link
Author

erfan71 commented Oct 13, 2018

But I get a new Error when the client is trying to get the result.
image

The RPC Server is not available !!

@asoleimanibo
Copy link

But I get a new Error when the client is trying to get the result.
image

The RPC Server is not available !!

Run RPC from Run>Services.msc>remote procedure call (RPC) and try again

@erfan71
Copy link
Author

erfan71 commented Oct 13, 2018

But I get a new Error when the client is trying to get the result.
image
The RPC Server is not available !!

Run RPC from Run>Services.msc>remote procedure call (RPC) and try again

I checked It, My RPC service is running
I also disable my firewall and Anti-virus but it doesn't help and I still get this error

@luty81
Copy link
Contributor

luty81 commented Oct 13, 2018 via email

@erfan71
Copy link
Author

erfan71 commented Oct 14, 2018

Thanks for the update.
I did that and I get the following results.

  1. I don't have any OvalResultDocumentTab. and It looks like it:

image

  1. I see the CollectionExecuations Tab and I have 2 document per RequestID. In following image, the documents with Id 1 and 2 are for Request id 1 and the documents with Id 3 and 4 are for Request Id 2.

image

Id 3 looks like it:

image

and Id 4 looks like it:

image

And that's exactly the error I get in the client.

  1. This is CollectRequest Document for Request id 2:

image

  1. It is definition document

image

Thank you in advance for your consideration.

@surgicalcoder
Copy link

But I get a new Error when the client is trying to get the result.
image

The RPC Server is not available !!

Can you try running against "localhost", without a port number? The Address field gets sent to the client, where it attempts a WMI connection on that port, I think that is where the problem is.

@erfan71
Copy link
Author

erfan71 commented Oct 15, 2018

YEEESSS. It worked. I changed the address bar to localhost and remove ":1000" and just add the port in the options menu.
I have also tested the newest oval definition file which I downloaded from here:
And it worked correctly and return the oval Result document.

Thanks, @surgicalcoder and @luty81 and @amirsoleimanii

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

4 participants