# Yara

### <mark style="color:red;">What is Yara?</mark>

### All about Yara

Yara can identify information based on both binary and textual patterns, such as hexadecimal and strings contained within a file. Yara rules are frequently used to label these patterns to determine if a file is malicious based upon features or patterns it presents. Because applications use strings to store data (text), strings are a fundamental component of programming languages.

**EX:** \
`print("Hello World!")` \
prints "Hello World" in Python and the text "Hello World" would be stored as string. \
A Yara rule could be written to search for "hello world" in every program on the OS.&#x20;

### Why does Malware use Strings?

Malware uses strings to store textual data. Some examples:

| Type       | Data                                                                                                                                  | Description                                             |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| Ransomware | <p><a href="https://www.blockchain.com/btc/address/12t9YDPgwueZ9NyMgw519p7AA8isjr6SMw">12t9YDPgwueZ9NyMgw519p7AA8isjr6SMw</a><br></p> | <p>Bitcoin Wallet for ransom payments<br></p>           |
| Botnet     | <p>12.34.56.7<br></p>                                                                                                                 | The IP address of the Command and Control (C\&C) server |

***What is the name of the base-16 numbering system that Yara can detect?***

hex

***Would the text "Enter your Name" be a string in an application? (Yay/Nay)***

yay

### <mark style="color:red;">Intro to Yara Rules</mark>

### Your First Yara Rule

Every `yara` command requires two arguments to be valid:

1. The rule file we create
2. Name of file, directory, or process ID to use the rule for.

Every rule must have a name and condition.&#x20;

**EX**:  \
to use "myrule.yar" on directory "some directory" use the following command:\
`yara myrule.yar somedirectory`

`.yar` is the standard file extension for all Yara rules.

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FTbIkBDgfuAlMiidU9xdh%2Fimage.png?alt=media&#x26;token=0b8269f1-b82b-49fe-9258-518a3ea72edf" alt=""><figcaption><p>creating rule</p></figcaption></figure>

The name of the rule in the **`.yar`** file above is `examplerule` with one condition. The condition is `condition`. This rule satisfies both requirements - a name and a condition.

The rule checks to see if the file/directory/PID to be specified exists via `condition: true`. If it does, an output will be given of `examplerule`.

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FARK9m4QTCOCEX7Y5QdiV%2Fimage.png?alt=media&#x26;token=7fb24c7d-3965-4261-9c1b-e051992777da" alt=""><figcaption><p>met condition</p></figcaption></figure>

Since `somefile` exists, Yara says `examplerule` because the pattern has been met.&#x20;

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FTCgs2uWsDYiXMul1K7Ic%2Fimage.png?alt=media&#x26;token=23e35cc6-c6d7-408c-b849-42799226425d" alt=""><figcaption><p>unmet condition</p></figcaption></figure>

### <mark style="color:red;">Expanding on Yara Rules</mark>

### Yara Conditions Continued...

Yara has a few conditions, which can be read [here](https://yara.readthedocs.io/en/stable/writingrules.html). Some important keywords are as follows:\
\&#xNAN;*<mark style="color:orange;">Desc</mark>*\
*<mark style="color:orange;">Meta</mark>*\
*<mark style="color:orange;">Strings</mark>*\
*<mark style="color:orange;">Conditions</mark>*\
*<mark style="color:orange;">Weight</mark>*

### Meta

This section of a Yara rule is reserved for descriptive information by the author of the rule.  `desc`, short for description, can be used to summarize what your the checks for. Anything within this section does not influence the rule itself. Similar to commenting code, it is useful to summarize rules.

### Strings

Strings can be used to search for specific text or hexadecimal in files or programs. To search a directory for all files containing "Hello World!", create a rule such as below:

```yaml
rule helloworld_checker{
	strings:
		$hello_world = "Hello World!"
}
```

The keyword `Strings` is defined where the string wanted to search `"Hello World!"` is stored within the variable `$hello_world`&#x20;

To make the rule valid, a condition is to be made. To make the string condition, use the variable's name:

```yaml
rule helloworld_checker{
	strings:
		$hello_world = "Hello World!"

	condition:
		$hello_world
}
```

If any file has the string `"Hello World!"`, the rule will match. This does NOT match `"hello world"` or `"HELLO WORLD."`

To solve this, the condition `any of them` allows multiple strings to be searched for:

```yaml
rule helloworld_checker{
	strings:
		$hello_world = "Hello World!"
		$hello_world_lowercase = "hello world"
		$hello_world_uppercase = "HELLO WORLD"

	condition:
		any of them
}
```

### Conditions

Like regular programming, operators can be used such as:&#x20;

<mark style="color:orange;"><=</mark> <mark style="color:orange;"></mark>*<mark style="color:orange;">less than or equal to</mark>*\ <mark style="color:orange;">>=</mark> <mark style="color:orange;"></mark>*<mark style="color:orange;">more than or equal to</mark>* \ <mark style="color:orange;">!=</mark> <mark style="color:orange;"></mark>*<mark style="color:orange;">not equal to</mark>*

**EX**:

```yaml
rule helloworld_checker{
	strings:
		$hello_world = "Hello World!"

	condition:
        #hello_world <= 10
}
```

This rule will:

1. Look for the "Hello World!" string
2. Only say the rule matches if there are less than or equal to ten occurrences of the "Hello World!" string

### Combining keywords

To combine multiple conditions, use keywords such as:\
\&#xNAN;*<mark style="color:orange;">and</mark>*\
*<mark style="color:orange;">not</mark>*\
*<mark style="color:orange;">or</mark>*

To check if a file has a string and is of a certain size, use a rule like below:

```yaml
rule helloworld_checker{
	strings:
		$hello_world = "Hello World!" 
        
        condition:
	        $hello_world and filesize < 10KB 
}
```

Information security researcher "fr0gger\_" created a [cheatsheet](https://medium.com/malware-buddy/security-infographics-9c4d3bd891ef#18dd) that breaks down and visualizes the elements of a YARA rule.

### <mark style="color:red;">Yara Modules</mark>

### Integrating With Other Libraries

Frameworks such as the [Cuckoo Sandbox](https://cuckoosandbox.org/) or [Python's PE Module](https://pypi.org/project/pefile/) allow improvement of the technicality of your Yara rules ten-fold.

### Cuckoo

Cuckoo Sandbox is an automated malware analysis environment that allows generating Yara rules based on behaviors discovered from CS. As this environment executes malware, rules can be created on specific behaviors such as runtime strings.&#x20;

### Python PE

Python's PE module allows to create Yara rules from the various sections and elements of the Windows Portable Executable (PE) structure. This structure is the standard formatting of all executables and DLL files on windows, including the programming libraries that are used.

Examining a PE file's contents is a technique in malware analysis because behaviors such as cryptography or worming can be identified without reverse engineering or execution of the sample.

### <mark style="color:red;">Other Tools and Yara</mark>

### Yara Tools

GitHub [resources](https://github.com/InQuest/awesome-yara) and open-source tools (along with commercial products) can be utilized to leverage Yara in hunt operations and/or incident response engagements.&#x20;

### LOKI

LOKI is a free open-source IOC (*Indicator of Compromise*) scanner created/written by Florian Roth.

Detection is based on 4 methods:

1. File Name IOC Check
2. Yara Rule Check (we are here)
3. Hash Check
4. C2 Back Connect Check

For a full rundown, please reference the [GitHub readme](https://github.com/Neo23x0/Loki/blob/master/README.md).

LOKI can be used on both Windows and Linux systems and can be downloaded [here](https://github.com/Neo23x0/Loki/releases).

### THOR

THOR *Lite* is Florian's newest multi-platform IOC AND YARA scanner, coming with precompiled versions for Windows, Linux, and macOS. TL's scan throttling limits exhausting CPU resources.&#x20;

For more information and/or to download the binary, start [here](https://www.nextron-systems.com/thor-lite/). Only subscribers can obtain a copy of the binary. Note that THOR is geared towards corporate customers. THOR Lite is the free version.

### FENRIR

Also created by Florian Roth, [Fenrir ](https://github.com/Neo23x0/Fenrir)was created to address the issue where requirements must be met to function. Fenrir is a bash script and will run on any system that is bash capable.&#x20;

### YAYA

YAYA (Yet another Yara Automation) was created by the [EFF](https://www.eff.org/deeplinks/2020/09/introducing-yaya-new-threat-hunting-tool-eff-threat-lab) (*Electronic Frontier Foundation*) and is an open-source tool to help researches manage multiple YARA rule repositories. YAYA imports a set of high-quality YARA rules and lets researchers add their own, disable specific rulesets, and run scans of files. YAYA only runs on Linux systems.

### <mark style="color:red;">Using LOKI and its Yara Rule Set</mark>

A security analyst may need to research threat intelligence and gather information on the latest tactics and tecniques used in the wild, past, or present. IOCs will typically be shared so rules can be created to detect these threats, along with Yara rules. In the event an unknown situation is encountered that a security stack of tools cannot or did not detect, tools such as Loki allows for adding personal rules based on threat intel gatherings or findings from an incident response engagement (forensics).

Loki has pre-imported Yara rules to benefit from and allows for immediate scanning for evil on the endpoint.&#x20;

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FMDREF5keaO3ZfoFT9STn%2Fimage.png?alt=media&#x26;token=d8f0a636-d955-460a-9a96-390291fda6d9" alt=""><figcaption><p>python loki.py -h</p></figcaption></figure>

When running Loki on your own system, the first command to run should be `--update`. This will add the `signature-base` directory which Loki uses to scan for known evil.

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FallfZq0weGNZX7DLVYYL%2Fimage.png?alt=media&#x26;token=ef8c7efa-243c-4a0a-9e61-b770c72a3d3c" alt=""><figcaption><p>signature-base</p></figcaption></figure>

Below is an example of a Yara rule from one of the yar files, `crime ranson generic.yar`:

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FdGWsDcUYQcewtyr2Shzy%2Fimage.png?alt=media&#x26;token=8cb2d246-3b51-45d6-a203-a9bdc04814bc" alt=""><figcaption><p>yara rule</p></figcaption></figure>

**Scenario**: You are the security analyst for a mid-size law firm. A co-worker discovered suspicious files on a web server within your organization. These files were discovered while performing updates to the corporate website. The files have been copied to your machine for analysis. The files are located in the `suspicious-files` directory. Use Loki to answer the questions below.

***Scan file 1. Does Loki detect this file as suspicious/malicious or benign?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FxnVV4h5SoKVMr0VadY6K%2Fimage.png?alt=media&#x26;token=e75ff689-4699-4475-b340-cda8dcb8c010" alt=""><figcaption><p>Loki file1</p></figcaption></figure>

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FeX9zpdJzfwhueUec14Gx%2Fimage.png?alt=media&#x26;token=e5c03367-e52e-403b-a740-719744d06364" alt=""><figcaption><p>suspicious</p></figcaption></figure>

***What Yara rule did it match on?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2Fb2cENFioioFRfKHwSjNf%2Fimage.png?alt=media&#x26;token=f392ba7e-8794-440a-8746-f38ffaecdafc" alt=""><figcaption><p>webshell metaslsoft</p></figcaption></figure>

***What does Loki classify this file as?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FSLZwRYQXl15lK8962Sd8%2Fimage.png?alt=media&#x26;token=211f65b1-fb29-43e4-a5b5-7c96a49e6cfc" alt=""><figcaption><p>webshell</p></figcaption></figure>

***Based on the output, what string within the Yara rule did it match on?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FXV1R4o4aJqAhdnfZhDwd%2Fimage.png?alt=media&#x26;token=4435e4e4-2801-46d2-9aac-77b9887f08a3" alt=""><figcaption><p>str1</p></figcaption></figure>

***What is the name and version of this hack tool?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FfJ8fjlocskZ2zgWwXGmy%2Fimage.png?alt=media&#x26;token=697cbe43-c76a-41a7-9529-c758b0be4d63" alt=""><figcaption><p>b374k 2.2</p></figcaption></figure>

***Inspect the actual Yara file that flagged file 1. Within this rule, how many strings are there to flag this file?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FhbCOkX2cxKC93SRMz1PS%2Fimage.png?alt=media&#x26;token=495fe9ef-1f2d-45a1-9be2-3ee1e0cf5606" alt=""><figcaption><p>1 string</p></figcaption></figure>

***Scan file 2. Does Loki detect this file as suspicious/malicious or benign?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FJ5GTFvItx9QodJoujQ1j%2Fimage.png?alt=media&#x26;token=fa2ffc2c-64da-4136-9e19-26caad676316" alt=""><figcaption><p>benign</p></figcaption></figure>

***Inspect file 2. What is the name and version of this web shell?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FRxnsDSuCqdQ33kkbgwDh%2Fimage.png?alt=media&#x26;token=88d7dafc-1f45-4893-b9cf-23747323e07a" alt=""><figcaption><p>b374k 3.2.3</p></figcaption></figure>

### <mark style="color:red;">Creating Yara Rules with yarGen</mark>

In the example previous, Loki found file2 to be benign/clean. This would render the scan useless on other web servers since that webshell will be undetected. Going through code manually can be very time consuming but something would need to be done to find specific strings to create a new Yara rule to detect the discovered webshell.&#x20;

[yarGen](https://github.com/Neo23x0/yarGen) is a generator for Yara rules. It works mostly by removing strings found in goodware files to better prepare for sifting through potentially important strings for the malicious file to then create a Yara rule. yarGen includes a big goodware strings and opcode database as ZIP archives that have to be extracted before the first use.

If running yarGen on a personal system, update it first by running `python3 yarGen.py --update` to update the good-opcodes and good-strings DB's from the online repository.

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FZVYFA5Kcc4Mz9VlVjNfW%2Fimage.png?alt=media&#x26;token=82608649-3143-4495-982c-b56e0a98b821" alt=""><figcaption><p>python3 yarGen.py --update</p></figcaption></figure>

To create a Yara rule for file2, run the following:<br>

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FXfew4GZ44rnKmrkzo0VO%2Fimage.png?alt=media&#x26;token=7502e964-253a-46f3-be0f-67cdefd6315c" alt=""><figcaption><p>yarGen.py -m --excludegood -o file2.yar</p></figcaption></figure>

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FRSZRNwZcJLW6GkbBFkGA%2Fimage.png?alt=media&#x26;token=71c3cfc3-0e93-4563-9102-3bb9de59d54e" alt=""><figcaption><p>finished yar file</p></figcaption></figure>

* `-m` is the path to the files you want to generate rules for
* `--excludegood` force to exclude all goodware strings (*these are strings found in legitimate software and can increase false positives*)
* `-o` location & name you want to output the Yara rule

Best practice would be to examine the Yara rule and remove any strings possible of creating false positives. **Note**: Another tool created to assist with this is called [yarAnalyzer](https://github.com/Neo23x0/yarAnalyzer/).

***From within the root of the suspicious files directory, what command would you run to test Yara and your Yara rule against file 2?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FE0WnprqT3KrjDWQKy7Nf%2Fimage.png?alt=media&#x26;token=059c620c-1ffd-4227-9ef0-89633d9ebda0" alt=""><figcaption><p>yara file2.yar file2/1ndex.php</p></figcaption></figure>

After creating the new rule, copy the .yar file to the Yara signature base folder then proceed to run Loki:

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FIQHJ4M6wNsVdW2mpfPIW%2Fimage.png?alt=media&#x26;token=03315086-7599-44be-a248-81eb498ed05f" alt=""><figcaption><p>python ../tools/Loki/loki.py -p file2</p></figcaption></figure>

***Did Yara rule flag file 2? (Yay/Nay)***

yay

***Test the Yara rule with Loki, does it flag file 2? (Yay/Nay)***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FWGKPLWmm4rQo7qSzVOVt%2Fimage.png?alt=media&#x26;token=742d117a-639d-4148-b6b1-99a62e7ee69d" alt=""><figcaption><p>yay</p></figcaption></figure>

***What is the name of the variable for the string that it matched on?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FwiwO3xjULgg032wyzBYd%2Fimage.png?alt=media&#x26;token=633cf74d-568b-4379-9526-e8464c9d88c8" alt=""><figcaption><p>zepto</p></figcaption></figure>

***Inspect the Yara rule, how many strings were generated?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FONnYCSUCsQzhsFxMSJpM%2Fimage.png?alt=media&#x26;token=3e300271-2a02-4ba1-aed8-06a3bb741af1" alt=""><figcaption><p>20</p></figcaption></figure>

***One of the conditions to match on the Yara rule specifies file size. The file has to be less than what amount?***

700kb

### <mark style="color:red;">Valhalla</mark>

[Valhalla ](https://valhalla.nextron-systems.com/)is an online Yara feed hosted by [Nextron-Systems](https://www.nextron-systems.com/valhalla/). Valhalla boosts detection capbilities with thousands of hand-crafted Yara rules.&#x20;

Searches can be administered based on keyword, tag, ATT\&CK technique, sha256, or rule name.

***Enter the SHA256 hash of file 1 into Valhalla. Is this file attributed to an APT group? (Yay/Nay)***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FsPUIr3kiDEfpiLmaEliS%2Fimage.png?alt=media&#x26;token=5a275fac-6d0b-45ea-b94c-f482baf990f9" alt=""><figcaption><p>file1</p></figcaption></figure>

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FYyhQ8j5exwnwPKkPq1dj%2Fimage.png?alt=media&#x26;token=40697f2f-8be8-4e9a-9f6a-e7ec3e29e553" alt=""><figcaption><p>yay</p></figcaption></figure>

***Do the same for file 2. What is the name of the first Yara rule to detect file 2?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FWdpewkb1beCdtu9kLSCS%2Fimage.png?alt=media&#x26;token=0cc26b49-ec77-4da1-a734-77da93f96b7c" alt=""><figcaption><p>file2</p></figcaption></figure>

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2F0UaAuB7hNCLZOoQfOHFy%2Fimage.png?alt=media&#x26;token=0407a002-9e06-42b4-9fdd-f2310ae4c2b1" alt=""><figcaption><p>Webshell_b374k_rule1</p></figcaption></figure>

***Examine the information for file 2 from Virus Total (VT). The Yara Signature Match is from what scanner?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FCiR310ABm7N9Y6OTVXO6%2Fimage.png?alt=media&#x26;token=4797e806-3ea1-4680-a4b1-d41891b24e95" alt=""><figcaption><p>THOR APT Scanner</p></figcaption></figure>

***Enter the SHA256 hash of file 2 into Virus Total. Did every AV detect this as malicious? (Yay/Nay)***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2F9dweRQlfkKn7sAwOK3hU%2Fimage.png?alt=media&#x26;token=fc8e8db7-9994-403c-bc26-e0966db660fe" alt=""><figcaption><p>Nay</p></figcaption></figure>

***Besides .PHP, what other extension is recorded for this file?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2F87sIA0LKMNajSM6PLUeu%2Fimage.png?alt=media&#x26;token=ee948ad1-eac9-4f49-b690-986867652227" alt=""><figcaption><p>.exe</p></figcaption></figure>

***What JavaScript library is used by file 2?***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FX8rlkuoS02HAwQUFey08%2Fimage.png?alt=media&#x26;token=d7375c3a-3d71-424e-b058-75bde40b32d7" alt=""><figcaption><p>zepto</p></figcaption></figure>

***Is this Yara rule in the default Yara file Loki uses to detect these type of hack tools? (Yay/Nay)***

<figure><img src="https://309112325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdUCUPJ7E8b7n8AB8j3ms%2Fuploads%2FDSO0ABWyxt8leR4X0weI%2Fimage.png?alt=media&#x26;token=c263b3f7-1d4e-4095-bd23-a907eeab3f72" alt=""><figcaption><p>nay</p></figcaption></figure>

The reason why file 2 was not detected is that the Yara rule was not in the Yara file used by Loki to detect the hack tool (web shell) even though its the hack tool has been around for years and has even been attributed to at least 1 nation-state. The Yara rule is present in the commercial variant of Loki, which is Thor.
