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

Signature Errors with latest commits #56

Closed
enzok opened this issue Jul 10, 2018 · 23 comments
Closed

Signature Errors with latest commits #56

enzok opened this issue Jul 10, 2018 · 23 comments

Comments

@enzok
Copy link
Contributor

enzok commented Jul 10, 2018

I added the latest commits and am now getting the following errors. I've run multiple samples and get the same results.

2018-07-09 22:00:36,972 [lib.cuckoo.core.plugins] ERROR: Failed to run signature "CheckRemoteDebuggerPresent":
Traceback (most recent call last):
  File "/opt/cuckoo/utils/../lib/cuckoo/core/plugins.py", line 414, in run
    result = sig.on_call(call, proc)
  File "/opt/cuckoo/utils/../modules/signatures/CAPE.py", line 558, in on_call
    ProcessInformationClass = int(self.get_raw_argument(call, "ProcessInformationClass"), 0)
TypeError: int() can't convert non-string with explicit base
2018-07-09 22:00:37,056 [lib.cuckoo.core.plugins] ERROR: Failed to run signature "critical_process":
Traceback (most recent call last):
  File "/opt/cuckoo/utils/../lib/cuckoo/core/plugins.py", line 414, in run
    result = sig.on_call(call, proc)
  File "/opt/cuckoo/utils/../modules/signatures/critical_process.py", line 34, in on_call
    value = int(self.get_argument(call, "Value"))
TypeError: int() argument must be a string or a number, not 'NoneType'
2018-07-09 22:00:37,056 [lib.cuckoo.core.plugins] ERROR: Failed to run signature "dep_disable":
Traceback (most recent call last):
  File "/opt/cuckoo/utils/../lib/cuckoo/core/plugins.py", line 414, in run
    result = sig.on_call(call, proc)
  File "/opt/cuckoo/utils/../modules/signatures/dep_disable.py", line 34, in on_call
    value = int(self.get_argument(call, "Value"))
TypeError: int() argument must be a string or a number, not 'NoneType'
2018-07-09 22:00:37,071 [lib.cuckoo.core.plugins] ERROR: Failed to run signature "NtSetInformationThread":
Traceback (most recent call last):
  File "/opt/cuckoo/utils/../lib/cuckoo/core/plugins.py", line 414, in run
    result = sig.on_call(call, proc)
  File "/opt/cuckoo/utils/../modules/signatures/CAPE.py", line 497, in on_call
    ThreadInformationClass = int(self.get_raw_argument(call, "ThreadInformationClass"), 0)
TypeError: int() can't convert non-string with explicit base

@kevoreilly
Copy link
Contributor

This is my bad - I updated the hook for NtSetInformationProcess and failed to make sure the sigs that depend on it still work. Apologies - should be fixed in latest commit.

@enzok
Copy link
Contributor Author

enzok commented Jul 10, 2018

Thanks. These errors were fixed.

I did get the following error running a Ursnif sample. It decoded the config so not sure if it's a real issue. I'll let you decided.

2018-07-10 11:27:38,879 [lib.cuckoo.core.plugins] ERROR: Failed to run signature "NtCreateThreadEx":
Traceback (most recent call last):
  File "/opt/cuckoo/utils/../lib/cuckoo/core/plugins.py", line 414, in run
    result = sig.on_call(call, proc)
  File "/opt/cuckoo/utils/../modules/signatures/CAPE.py", line 517, in on_call
    ThreadCreationFlags = int(self.get_raw_argument(call, "CreateFlags"), 0)
TypeError: int() can't convert non-string with explicit base

@redsand
Copy link
Contributor

redsand commented Jul 10, 2018

Good find. thanks for this

@kevoreilly
Copy link
Contributor

Should be fixed now

@kevoreilly
Copy link
Contributor

Damn actually this looks to be because I had a slightly different hook for NtCreateThreadEx for the Ursnif package. I had 'CreationFlags' to be more like the other hook creation functions whereas the current hook has 'CreateFlags' for this argument (it's not easy to find the actual prototype, some even have this as a BOOL CreateSuspended). I have a new version of the Ursnif package in the works which has 'CreateFlags' but I will need to publish this then switch the signature back again...

@redsand
Copy link
Contributor

redsand commented Jul 10, 2018 via email

@enzok
Copy link
Contributor Author

enzok commented Jul 23, 2018

Just got back from vacation. I added the CAPE commits since July 10th and am getting the following in my logs:

2018-07-23 13:44:56,090 [lib.cuckoo.core.plugins] ERROR: Failed to run signature "NtCreateThreadEx":
Traceback (most recent call last):
  File "/opt/cuckoo/utils/../lib/cuckoo/core/plugins.py", line 414, in run
    result = sig.on_call(call, proc)
  File "/opt/cuckoo/utils/../modules/signatures/CAPE.py", line 527, in on_call
    ThreadCreationFlags = int(self.get_raw_argument(call, "CreationFlags"), 16)
TypeError: int() can't convert non-string with explicit base
2018-07-23 13:44:56,090 [lib.cuckoo.core.plugins] ERROR: Failed to run signature "NtCreateThreadEx":
Traceback (most recent call last):
  File "/opt/cuckoo/utils/../lib/cuckoo/core/plugins.py", line 414, in run
    result = sig.on_call(call, proc)
  File "/opt/cuckoo/utils/../modules/signatures/CAPE.py", line 527, in on_call
    ThreadCreationFlags = int(self.get_raw_argument(call, "CreationFlags"), 16)
TypeError: int() can't convert non-string with explicit base

@kevoreilly
Copy link
Contributor

I've just pushed a fix for this but this will unfortunately mean you will get sig errors with the Ursnif package as it had a different label for the NtCreateThreadEx argument (CreationFlags) - until I push an update to the Ursnif Dlls. I will try and get that done soon, I have an update in the works.

@enzok
Copy link
Contributor Author

enzok commented Jul 24, 2018

That is the error I received with the latest commits on a non-Ursnif sample. I did check the MD5s to confirm that I have the latest analyzer DLLs.

@kevoreilly
Copy link
Contributor

This should be fixed now (except for Ursnif package which I will update soon).

@enzok
Copy link
Contributor Author

enzok commented Jul 27, 2018

Is there an updated DLL or just the Cape.py file?

@kevoreilly
Copy link
Contributor

The majority of the DLLs already have the matching argument string 'CreateFlags'. The exception to this is the Ursnif DLLs (CreationFlags) but I have an updated version which I plan to release soon.

@enzok
Copy link
Contributor Author

enzok commented Jul 27, 2018

OK understood. Thank you.

@enzok
Copy link
Contributor Author

enzok commented Jul 27, 2018

Still getting this error.

2018-07-27 10:23:24,083 [lib.cuckoo.core.plugins] ERROR: Failed to run signature "NtCreateThreadEx":
Traceback (most recent call last):
  File "/opt/cuckoo/utils/../lib/cuckoo/core/plugins.py", line 414, in run
    result = sig.on_call(call, proc)
  File "/opt/cuckoo/utils/../modules/signatures/CAPE.py", line 527, in on_call
    ThreadCreationFlags = int(self.get_raw_argument(call, "CreateFlags"), 16)
TypeError: int() can't convert non-string with explicit base

@kevoreilly
Copy link
Contributor

I'm confused - you seem to be getting the errors whether it's "CreateFlags" or "CreationFlags". The hook code for NtCreateThreadEx is in https://github.com/ctxis/capemon/blob/capemon/hook_thread.c and currently has "CreateFlags" which should correlate with the signature.

@enzok
Copy link
Contributor Author

enzok commented Jul 27, 2018

i verified md5 values for the CAPE DLLs and they match your latest build. Verified I have the latest Cape.py. What else can I do to troubleshoot?

@kevoreilly
Copy link
Contributor

Can you check the behavioural logs - search for the NtCreateThreadEx calls and see whether they are listed with 'CreateFlags' or 'CreationFlags' as argument.

@enzok
Copy link
Contributor Author

enzok commented Jul 27, 2018

LOL. I was doing that as you were commenting.

Looks like the correct call argument. So the hook is working. Maybe something with parsing the value?

{
                        "category": "threading",
                        "parentcaller": "0x00000000",
                        "return": "0x00000000",
                        "timestamp": "2018-07-27 10:35:07,734",
                        "caller": "0x00000000",
                        "thread_id": "2592",
                        "repeated": 0,
                        "api": "NtCreateThreadEx",
                        "status": true,
                        "arguments": [
                            {
                                "name": "ThreadHandle",
                                "value": "0x00000258"
                            },
                            {
                                "name": "ProcessHandle",
                                "value": "0xffffffff"
                            },
                            {
                                "name": "CreateFlags",
                                "value": "0x00000003"
                            },
                            {
                                "name": "StartAddress",
                                "value": "0x77c42e65"
                            }
                        ],
                        "id": 377
                    },

And...

                    {
                        "category": "threading",
                        "parentcaller": "0x13fcc1ff9",
                        "return": "0x00000000",
                        "timestamp": "2018-07-27 10:35:30,510",
                        "caller": "0x13fcc1a14",
                        "thread_id": "2120",
                        "repeated": 0,
                        "api": "NtCreateThreadEx",
                        "status": true,
                        "arguments": [
                            {
                                "name": "ThreadHandle",
                                "value": "0x0000013c"
                            },
                            {
                                "name": "ProcessHandle",
                                "value": "0xffffffffffffffff"
                            },
                            {
                                "name": "CreateFlags",
                                "value": "0x00000003"
                            },
                            {
                                "name": "StartAddress",
                                "value": "0x77a2aef0"
                            }
                        ],
                        "id": 50
                    },

And...

                    {
                        "category": "threading",
                        "parentcaller": "0x00411e81",
                        "return": "0x00000000",
                        "timestamp": "2018-07-27 10:36:12,817",
                        "caller": "0x004095a9",
                        "thread_id": "276",
                        "repeated": 0,
                        "api": "NtCreateThreadEx",
                        "status": true,
                        "arguments": [
                            {
                                "name": "ThreadHandle",
                                "value": "0x00000134"
                            },
                            {
                                "name": "ProcessHandle",
                                "value": "0xffffffff"
                            },
                            {
                                "name": "CreateFlags",
                                "value": "0x00000003"
                            },
                            {
                                "name": "StartAddress",
                                "value": "0x77c42e65"
                            }
                        ],
                        "id": 558
                    },
                {
                    "category": "threading",
                    "parentcaller": "0xff7a3a19",
                    "return": "0x00000000",
                    "timestamp": "2018-07-27 10:36:24,938",
                    "caller": "0xff7a354d",
                    "thread_id": "2644",
                    "repeated": 0,
                    "api": "NtCreateThreadEx",
                    "status": true,
                    "arguments": [
                        {
                            "name": "ThreadHandle",
                            "value": "0x000000dc"
                        },
                        {
                            "name": "ProcessHandle",
                            "value": "0xffffffffffffffff"
                        },
                        {
                            "name": "CreateFlags",
                            "value": "0x00000003"
                        },
                        {
                            "name": "StartAddress",
                            "value": "0x77a2aef0"
                        }
                    ],
                    "id": 21
                },
And...
                {
                    "category": "threading",
                    "parentcaller": "0x00403cd3",
                    "return": "0x00000000",
                    "timestamp": "2018-07-27 10:37:32,939",
                    "caller": "0x00407810",
                    "thread_id": "628",
                    "repeated": 0,
                    "api": "NtCreateThreadEx",
                    "status": true,
                    "arguments": [
                        {
                            "name": "ThreadHandle",
                            "value": "0x00000118"
                        },
                        {
                            "name": "ProcessHandle",
                            "value": "0xffffffff"
                        },
                        {
                            "name": "CreateFlags",
                            "value": "0x00000003"
                        },
                        {
                            "name": "StartAddress",
                            "value": "0x77c42e65"
                        }
                    ],
                    "id": 66
                },
And...
```                    {
                        "category": "threading",
                        "parentcaller": "0x00000000",
                        "return": "0x00000000",
                        "timestamp": "2018-07-27 10:34:24,568",
                        "caller": "0x00000000",
                        "thread_id": "2368",
                        "repeated": 0,
                        "api": "NtCreateThreadEx",
                        "status": true,
                        "arguments": [
                            {
                                "name": "ThreadHandle",
                                "value": "0x000001d0"
                            },
                            {
                                "name": "ProcessHandle",
                                "value": "0xffffffff"
                            },
                            {
                                "name": "CreateFlags",
                                "value": "0x00000003"
                            },
                            {
                                "name": "StartAddress",
                                "value": "0x77c42e65"
                            }
                        ],
                        "id": 367
                    },

@enzok
Copy link
Contributor Author

enzok commented Jul 27, 2018

Should the method here be get_argument instead of get_raw_argument?

@enzok
Copy link
Contributor Author

enzok commented Jul 27, 2018

Ignore my last comment.

I changed the base and it seems to have fixed the issue (16 to 0):

ThreadCreationFlags = int(self.get_raw_argument(call, "CreateFlags"), 0)

@kevoreilly
Copy link
Contributor

Damn this was my fault! Sorry about that, just pushed the fix. Thanks for your help.

@enzok
Copy link
Contributor Author

enzok commented Jul 27, 2018

Glad to help. I'll close this out unless you want me to wait until you push the Ursnif update.

@kevoreilly
Copy link
Contributor

I'll close this now but will try and get the Ursnif update published soon.

kevoreilly added a commit that referenced this issue Aug 22, 2019
Increase severity on registry PE
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

3 participants