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

Unable to use linux packages #1166

Closed
6 tasks done
alx1m1k opened this issue Sep 24, 2022 · 10 comments
Closed
6 tasks done

Unable to use linux packages #1166

alx1m1k opened this issue Sep 24, 2022 · 10 comments

Comments

@alx1m1k
Copy link

alx1m1k commented Sep 24, 2022

About accounts on capesandbox.com

  • Issues isn't the way to ask for account acctivation. Ping capesandbox in Twitter with your username

This is opensource and you getting free support so be friendly!

  • Free support from doomedraven ended, no whiskey no support. For something he updated the documentation :)

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I did read the README!
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (for multi-repository projects)
  • I'm have read all configs with all optional parts

Expected Behavior

Can select package for linux VM via web interface or utils/submit.py, analysis performs via correct linux package

Current Behavior

It is impossible to select linux package via Submit/Analysis package (for an example bash package exists in analyzer/linux/modules/packages/ but is absent in web UI menu). Even if package is specified in commandline for submit.py, cape is not honoring it - analysis starts without any package, or not starts at all (stuck in pending state). Don't know if this is a misconfiguration / bug, or absence of support is expected (in that case it's strange, why analyzer/linux exists)

Failure Information (for bugs)

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. take elf or bash script
  2. submit it via submit.py or web interface
  3. task stuck at pending state or executed without any package

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Question Answer
Git commit commit c0d553a
OS version Ubuntu 20.04.5 LTS (same for 22.04.1 LTS)

conf/web.conf

#enable linux fields on webgui
[linux]
#For advanced users only, can be buggy, linux analysis is work in progress for fun
enabled = yes

Failure Logs

cape@cape01:/opt/CAPEv2$ python3 -m poetry run python utils/submit.py --machine cuckoo-ub1804 --platform linux --package bash /tmp/virus.sh
INFO:lib.cuckoo.core.database:Do sandbox packages need an update? Sflock identifies as: False - b'/tmp/cuckoo-tmp/upload_mkpgp6j3/virus.sh'
Success: File "/tmp/virus.sh" added as task with ID 8

2022-09-24 19:13:23,003 [root] DEBUG: Starting analyzer from: /tmppu60lwlo
2022-09-24 19:13:23,003 [root] DEBUG: Storing results at: /tmp/tTpIcbq
2022-09-24 19:13:23,003 [lib.core.packages] INFO: _guess_package_name failed
2022-09-24 19:13:23,004 [lib.core.packages] INFO: ASCII text
2022-09-24 19:13:23,004 [lib.core.packages] INFO: virus.sh

screenshot

@doomedraven
Copy link
Collaborator

do you have enabled DYNAMIC_ARCH_DETERMINATION by this web_conf.general.dynamic_arch_determination? inside of web.conf?

@alx1m1k
Copy link
Author

alx1m1k commented Sep 27, 2022

Hello, thank you for your reply.

Yes, dynamic arch and platform determinations are enabled in web config

# Assign architecture to task to fetch correct VM type
dynamic_arch_determination = yes
# Assign platform to task to fetch correct VM type
dynamic_platform_determination = yes

@doomedraven
Copy link
Collaborator

doomedraven commented Sep 27, 2022 via email

@nbargnesi
Copy link
Contributor

I've got a fair bit of Linux changes in the works that could help here.

@cccs-kevin
Copy link
Collaborator

@nbargnesi do you have a status update on your aforementioned Linux changes? I'm wondering because I've also hit a wall in terms of Linux detonation.

@nbargnesi
Copy link
Contributor

Not yet, but I've got Ubuntu 20.04/22.04, Oracle, and Fedora linux detonating in CAPE regularly it just takes a fair bit of work to get there. Part of the problem is how outdated open source Linux malware analysis is everywhere you look.

Here's a sense for the initial bit of what's needed to make CAPE decent at doing Linux malware - no particular order:

Some point this month, my current plan is to kick off a long-lived branch to start collecting these changes, maybe do something like what @doomedraven did with his big v2 PR some time ago. I don't see a good path to a set of smaller PRs.

nbargnesi added a commit to nbargnesi/CAPEv2 that referenced this issue Feb 1, 2023
This is a suitable replacement for the existing strace script and is
known to work on Red Hat Enterprise Linux, Oracle Linux, Fedora, and
Ubuntu with a bit of coaxing and gentle prodding. RPM-based
distributions are the most straightforward and tend to work on nearly
every kernel release. Ubuntu frequently breaks.

Basic SystemTap instructions for each distro look something like this:

Red Hat Enterprise Linux:

 - enable the debug RPMs repos using subscription-manager
 - install systemtap, kernel debuginfo, and debug info common

Oracle Linux (9):

 - install systemtap and kernel-uek-devel
 - pull the debug info packages from oss.oracle.com/ol9/debuginfo
 - install the debuginfo and debug info common packages

Fedora Linux:

 - dnf install systemtap-client systemtap-devel systemtap
 - stap-prep

Ubuntu:

 - add the dbgsym release key for ddebs.ubuntu.com
 - add an apt source for ddebs.ubuntu.com
 - update the apt cache
 - install linux-headers-$(uname -r) and linux-image-$(uname -r)-dbgsym

- kevoreilly#1166
@Yesisyes
Copy link

Hi.I have seen your branch. Have you tested which files can be correctly analyzed in the ubuntu virtual machine? Thank you. @nbargnesi

@nbargnesi
Copy link
Contributor

Hi.I have seen your branch. Have you tested which files can be correctly analyzed in the ubuntu virtual machine? Thank you. @nbargnesi

With Ubuntu VMs specifically, coverage isn't too good. This is based on how Ubuntu generally fairs with SystemTap support, which is to say in general not very well.

Ubuntu 22.04 with the SystemTap rewrite in my branch will work, but you'll need to turn on SystemTap's guru mode when building the kernel module, to help work around the instrumentation overhead.

In the end, you'll be able to analyze files, but CAPE needs a lot more work to make sense of the results.

@Yesisyes
Copy link

Okay, I understand. It seems like it takes a lot of effort to debug. It doesn't seem suitable for me now. I can only wish the pioneers in this field no more bugs 😀@nbargnesi**_

@doomedraven
Copy link
Collaborator

this is now should be fixed, so closing this issue

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

5 participants