cuckoosandbox / cuckoo

Cuckoo Sandbox is an automated dynamic malware analysis system
http://www.cuckoosandbox.org
Other
5.53k stars 1.7k forks source link

Can't analyze Mac OS program #3084

Closed cc-sir closed 4 years ago

cc-sir commented 4 years ago

My host is Win10, and the guest host is Mac os 10.11 that running in the VirtualBox; When I submit the binary file by cuckoo submit, the cuckoo could work nice, however, the guest will always on analyzing until cuckoo over timeout; And the result of the reports.json file didn't have any binary file behavior. May be it will stop in this code: image I have no idea how to do anything, hope who can help me, thanks very much. reports.json:

{
    "info": {
        "added": 1596807261.189, 
        "started": 1596807261.983, 
        "duration": 203, 
        "ended": 1596807465.849, 
        "owner": null, 
        "score": 0.0, 
        "id": 8, 
        "category": "file", 
        "git": {
            "head": "13cbe0d9e457be3673304533043e992ead1ea9b2", 
            "fetch_head": "13cbe0d9e457be3673304533043e992ead1ea9b2"
        }, 
        "monitor": "2deb9ccd75d5a7a3fe05b2625b03a8639d6ee36b", 
        "package": "", 
        "route": "none", 
        "custom": null, 
        "machine": {
            "status": "stopped", 
            "name": "Mac", 
            "label": "MacOS10.11", 
            "manager": "VirtualBox", 
            "started_on": "2020-08-07 13:34:22", 
            "shutdown_on": "2020-08-07 13:37:45"
        }, 
        "platform": null, 
        "version": "2.0.7", 
        "options": ""
    }, 
    "signatures": [], 
    "target": {
        "category": "file", 
        "file": {
            "yara": [], 
            "sha1": "1e3713230fed4419dcb3dedfad25af8277d6fdea", 
            "name": "babyMac", 
            "type": "Mach-O 64-bit x86_64 executable", 
            "sha256": "a1581594807a002a9a9af92333b715c03923f519c78abc230f41a8f4914ae14e", 
            "urls": [], 
            "crc32": "FD700454", 
            "path": "C:\\Users\\cc-sir\\.cuckoo\\storage\\analyses\\8\\binary", 
            "ssdeep": null, 
            "size": 17836, 
            "sha512": "05dc25b2bfb52cb1d5c666a3fa45d98f90f31f84df1be120c9b418fc61e80900bf537e86d2c8d82a0e624b51c45604d0da456e153785b64c6a82ce6a75f4184e", 
            "md5": "b4aed8510cde5f9bdb08269b4850c355"
        }
    }, 
    "debug": {
        "action": [], 
        "dbgview": [], 
        "errors": [
            "Unable to stop auxiliary module: Sniffer\nTraceback (most recent call last):\n  File \"c:\\python27-x64\\lib\\site-packages\\cuckoo\\core\\plugins.py\", line 164, in stop\n    module.stop()\n  File \"c:\\python27-x64\\lib\\site-packages\\cuckoo\\auxiliary\\sniffer.py\", line 176, in stop\n    self._check_output(out, err)\n  File \"c:\\python27-x64\\lib\\site-packages\\cuckoo\\auxiliary\\sniffer.py\", line 137, in _check_output\n    \"the following standard error output: %r.\" % line\nCuckooOperationalError: Potential error while running tcpdump, did not expect the following standard error output: 'tcpdump.exe: listening on \\\\Device\\\\NPF_{B6D097F3-8EEE-4009-BCCE-7745BFB29215}'."
        ], 
        "log": [], 
        "cuckoo": [
            "2020-08-07 13:34:22,142 [cuckoo.core.scheduler] INFO: Task #8: acquired machine Mac (label=MacOS10.11)\n", 
            "2020-08-07 13:34:22,144 [cuckoo.core.resultserver] DEBUG: Now tracking machine 192.168.56.103 for task #8\n", 
            "2020-08-07 13:34:22,145 [cuckoo.core.plugins] DEBUG: Started auxiliary module: Replay\n", 
            "2020-08-07 13:34:22,164 [cuckoo.auxiliary.sniffer] INFO: Started sniffer with PID 288 (interface=3, host=192.168.56.103)\n", 
            "2020-08-07 13:34:22,164 [cuckoo.core.plugins] DEBUG: Started auxiliary module: Sniffer\n", 
            "2020-08-07 13:34:22,234 [cuckoo.machinery.virtualbox] DEBUG: Starting vm MacOS10.11\n", 
            "2020-08-07 13:34:22,589 [cuckoo.machinery.virtualbox] DEBUG: Restoring virtual machine MacOS10.11 to sir7\n", 
            "2020-08-07 13:34:38,013 [cuckoo.core.guest] INFO: Starting analysis #8 on guest (id=Mac, ip=192.168.56.103)\n", 
            "2020-08-07 13:34:39,016 [cuckoo.core.guest] DEBUG: Mac: not ready yet\n", 
            "2020-08-07 13:34:40,019 [cuckoo.core.guest] DEBUG: Mac: not ready yet\n", 
            "2020-08-07 13:34:41,022 [cuckoo.core.guest] DEBUG: Mac: not ready yet\n", 
            "2020-08-07 13:34:42,023 [cuckoo.core.guest] DEBUG: Mac: not ready yet\n", 
            "2020-08-07 13:34:42,030 [cuckoo.core.guest] INFO: Guest is running Cuckoo Agent 0.10 (id=Mac, ip=192.168.56.103)\n", 
            "2020-08-07 13:34:42,040 [cuckoo.core.guest] DEBUG: Uploading analyzer to guest (id=Mac, ip=192.168.56.103, monitor=latest, size=109710)\n", 
            "2020-08-07 13:34:45,670 [cuckoo.core.resultserver] DEBUG: Task #8: live log analysis.log initialized.\n", 
            "2020-08-07 13:34:47,303 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:34:52,338 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:34:57,362 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:02,382 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:07,408 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:12,440 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:17,460 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:22,484 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:27,506 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:32,533 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:37,563 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:42,585 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:47,628 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:52,651 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:35:57,674 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:02,723 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:07,759 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:12,799 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:17,822 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:22,845 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:27,868 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:32,894 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:37,926 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:42,950 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:47,971 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:53,002 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:36:58,025 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:37:03,056 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:37:08,088 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:37:13,109 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:37:18,132 [cuckoo.core.guest] DEBUG: Mac: analysis #8 still processing\n", 
            "2020-08-07 13:37:23,161 [cuck"
        ]
    }, 
    "metadata": {
        "output": {
            "pcap": {
                "basename": "dump.pcap", 
                "sha256": "acc530668c8bc60b2d229281130b1899bfc81d70fdada5c34b3236c628f739c8", 
                "dirname": "\\"
            }
        }
    }, 
    "strings": [
        "__PAGEZERO", 
        "__TEXT", 
        "__text", 
        "__TEXT", 
        "__stubs", 
        "__TEXT", 
        "__stub_helper", 
        "__TEXT", 
        "__cstring", 
        "__TEXT", 
        "__unwind_info", 
        "__TEXT", 
        "__DATA_CONST", 
        "__DATA_CONST", 
        "__DATA", 
        "__la_symbol_ptr", 
        "__DATA", 
        "__data", 
        "__DATA", 
        "__common", 
        "__DATA", 
        "__LINKEDIT", 
        "/usr/lib/dyld", 
        "/usr/lib/libSystem.B.dylib", 
        "Say something?", 
        "gift:%p", 
        "------------------------------------------------------------------------------", 
        "Welcome to WMCTF!", 
        "[A] Add    Note", 
        "[E] Edit   Note", 
        "[S] Show   Note", 
        "[D] Del    Note", 
        "[Q] Exit", 
        "Choice: ", 
        "size? ", 
        "Too small!", 
        "Too big!", 
        "Alloc success!", 
        "Wrong idx!", 
        "Empty!", 
        "content? ", 
        "Edit success!", 
        "Show success!", 
        "Delete success!", 
        "Magic Edit!", 
        "Wrong Command!", 
        "@___stack_chk_guard", 
        "@___stderrp", 
        "@___stdinp", 
        "@___stdoutp", 
        "@dyld_stub_binder", 
        "@___stack_chk_fail", 
        "@_alarm", 
        "@_atoi", 
        "@_chroot", 
        "@_exit", 
        "@_free", 
        "@_getcwd", 
        "@_malloc", 
        "@_memset", 
        "@_printf", 
        "@_puts", 
        "@_read", 
        "@_setbuf", 
        "@_setuid", 
        "@_strcmp", 
        "_mh_execute_header", 
        "kread_", 
        "}find_empty_index", 
        "note_list", 
        "__mh_execute_header", 
        "_find_empty_index", 
        "_initIO", 
        "_note_list", 
        "_read_char", 
        "_read_num", 
        "___stack_chk_fail", 
        "___stack_chk_guard", 
        "___stderrp", 
        "___stdinp", 
        "___stdoutp", 
        "_alarm", 
        "_chroot", 
        "_getcwd", 
        "_malloc", 
        "_memset", 
        "_printf", 
        "_setbuf", 
        "_setuid", 
        "_strcmp", 
        "dyld_stub_binder", 
        "__dyld_private"
    ], 
    "network": {
        "tls": [], 
        "udp": [], 
        "dns_servers": [], 
        "http": [], 
        "icmp": [], 
        "smtp": [], 
        "tcp": [], 
        "smtp_ex": [], 
        "mitm": [], 
        "hosts": [], 
        "pcap_sha256": "acc530668c8bc60b2d229281130b1899bfc81d70fdada5c34b3236c628f739c8", 
        "dns": [], 
        "http_ex": [], 
        "domains": [], 
        "dead_hosts": [], 
        "irc": [], 
        "https_ex": []
    }
}
cc-sir commented 4 years ago

I found the reason, the apicalls.d may have some questions, but I have no idea:

dtrace: failed to compile script /tmpYhyftk/lib/dtrace/apicalls.d: line 50: args[ ] may not be referenced because probe description proc:::create matches an unstable set of probes

/tmpYhyftk/lib/dtrace/apicalls.d:

#pragma D option destructive
#pragma D option quiet
/* apicalls.d
 *
 * Copyright (C) 2015 Dmitry Rodionov
 * This software may be modified and distributed under the terms
 * of the MIT license. See the LICENSE file for details.
 *
 * This script prints results in JSON format, each log entry is a dictionary:
 * {
 *     api         : string,            // e.g. "fprintf"
 *     args        : array,             // e.g. [1489124712123, "Hello\n!"]
 *     retval      : string OR integer, // e.g. "kkk"
 *     timestamp   : integer,           // e.g. 1433765405
 *     pid         : integer,           // e.g. 9213
 *     ppid        : integer,           // e.g. 9210
 *     tid         : integer,           // e.g. 269040
 *     errno       : integer            // e.g. 22
 * }
 *
 */
#define SCRIPT_NAME "apicalls.d"

#ifndef ANALYSIS_TIMEOUT
    #define ANALYSIS_TIMEOUT (-1)
#endif

dtrace:::BEGIN
{
    countdown = ANALYSIS_TIMEOUT;

    self->deeplevel = 0;
    self->arg0  = (int64_t)0;
    self->arg1  = (int64_t)0;
    self->arg2  = (int64_t)0;
    self->arg3  = (int64_t)0;
    self->arg4  = (int64_t)0;
    self->arg5  = (int64_t)0;
    self->arg6  = (int64_t)0;
    self->arg7  = (int64_t)0;
    self->arg8  = (int64_t)0;
    self->arg9  = (int64_t)0;
    self->arg10 = (int64_t)0;
    self->arg11 = (int64_t)0;
}

profile:::tick-1sec
/ countdown > 0 /
{
    --countdown;
}

profile:::tick-1sec
/ countdown == 0 /
{
    exit(0);
}

#pragma mark - Following children
#include "follow_children.d"

/* We may use `sudo -u` to drop (root) privileges before running a target.
 * If this were the case, we wouldn't care about API calls of sudo itself, thus
 * no probes.
 */
#ifndef SUDO

/* ******* **************************** ******* */
self int64_t arguments_stack[unsigned long, string];
self deeplevel;
/* ******* **************************** ******* */

#pragma mark - Probes
#include "probes.d"

/* exec* probes are special: they don't return on success; so catch them early */
pid$target::execve:entry
{
    this->retval = 0;
    this->timestamp_ms = walltimestamp/1000000;

    printf("{\"api\":\"%s\", \"args\":[\"%S\", %llu, %llu], \"retval\":%d, \"timestamp\":%lld, \"pid\":%d, \"ppid\":%d, \"tid\":%d, \"errno\":%d}\n",
        probefunc,
        arg0 != (int64_t)NULL ? copyinstr(arg0) : "<NULL>", (unsigned long long)arg1, (unsigned long long)arg2,
        (int)this->retval,
        (int64_t)this->timestamp_ms, pid, ppid, tid, errno);
}

#endif /* not SUDO */