Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 37 ยท Getting Started

Ethics, Law and Safety Rules

Learn the legal limits, ethical principles and practical safety rules every malware analyst follows: authorization, containment, data handling and responsible sharing.

Malware analysts handle dangerous material for a living, so the profession depends on discipline. Before you touch a single sample you need to know three things: what the law allows, what ethics expects, and which safety rules prevent an accident. This lesson is deliberately placed early because every later lab assumes you follow it.

This lesson is general education, not legal advice. Laws differ by country and employer. When in doubt, ask your organization's legal or security leadership before you act.

Why this matters

A sample is not a specimen under glass. It is live code designed to spread, steal or destroy. Mistakes have real victims: analysts have accidentally infected their employers' networks, leaked customer data found inside samples, or uploaded confidential documents to public scanning sites. Good intentions do not undo that.

Rules vary, but several principles are close to universal.

  • Authorization: Only analyze files you are entitled to examine, such as samples from your own incident, from a research feed you subscribe to, or from public repositories that permit research. Accessing computers or networks without permission is a crime in most countries (for example under computer-misuse laws).
  • No attacking back: You may be tempted to scan, exploit or take down the attacker's server you discovered. Do not. "Hack back" is generally illegal and can hurt innocent third parties, because attacker infrastructure is often compromised sites belonging to ordinary people. Report it to the hosting provider, a CERT or law enforcement instead.
  • Possession and distribution: Owning samples for research is typically allowed, but sending working malware to others, hosting it for download or using it against a target is not. Share through trusted channels with appropriate handling instructions.
  • Personal data: Samples and memory dumps may include credentials, emails or customer records. Privacy rules (GDPR and similar) can apply to what you find.
  • Employer and contract rules: Many companies restrict which tools, networks and cloud services analysts may use.

Ethical principles

  1. Do no harm. Your work should reduce harm, never create it.
  2. Minimize exposure. Handle only what you need, share only what is necessary, and delete what you no longer need according to policy.
  3. Be honest in reports. State confidence levels, say what you did not check, and never claim certainty you lack.
  4. Responsible disclosure. When you find a vulnerability or victim data, notify the vendor or affected party through proper channels, not social media.
  5. Respect victims. Stolen data found in a sample belongs to people. Treat it as sensitive.

Practical safety rules

These rules protect you and everyone near your lab.

Rule Reason
Never analyze on your everyday computer A single mistake infects your real files and accounts
Use an isolated virtual machine with no route to the real network Prevents spreading and accidental attacks from your IP
Take a clean snapshot and revert after each run Guarantees a known starting state
Disable shared folders, clipboard sharing and drag-and-drop These are escape and leak paths
Keep samples inside password-protected archives while stored Stops accidental execution and antivirus surprises
Rename or defang samples and indicators A clickable link or double-clickable file is an accident waiting to happen
Do not log in to personal accounts in the lab Malware may steal the credentials
Keep software and the host updated Escapes exist for hypervisors, though they are rare
Write down what you did Notes protect you if something goes wrong

The details of building such a lab come in Building a Safe Analysis Lab.

Defanging indicators

Writing a live URL into a ticket or chat can cause someone to click it. Defanging changes an indicator so it is inert but still readable: hxxp://evil[.]example[.]test/payload. The program below converts both ways. It only manipulates text.

Python Defang and refang indicators

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Addresses like 203.0.113.45 and domains ending in .test or example.test come from ranges reserved for documentation, so they never point at a real victim. Use them in your own examples too.

A simple pre-flight checklist

Before running anything in a lab, many teams run a literal checklist. Here is one as code, which you can adapt into your own notes.

Python Pre-flight checklist

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

What to do when something goes wrong

  • A sample ran on the wrong machine: disconnect it from the network immediately, tell your security lead, and follow your incident procedure. Do not hide it.
  • You found customer data: stop, note where, escalate. Do not copy it around.
  • You found a live attacker server: record it as an indicator and report it. Do not probe it.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. You discover the server a sample contacts. What should you do?

    Attacking back is generally illegal and can harm innocent owners of compromised servers. Report through hosting providers, CERTs or law enforcement.
  2. 2. Why should samples be stored in password-protected archives?

    An archive means no one double-clicks the sample by accident and scanners will not quarantine it mid-transfer.
  3. 3. What does defanging an indicator do?

    Defanged indicators cannot be clicked or resolved by accident but can be turned back into the original when needed.
  4. 4. Which is the safest place to run an unknown sample?

    An isolated VM you can revert contains the damage. Everyday systems must never be used.

Summary

  • Analyze only samples you are authorized to examine; never attack the infrastructure you find.
  • Treat data inside samples as sensitive and share through trusted channels.
  • Use an isolated, snapshotted VM, store samples in archives, and defang indicators.
  • Use reserved documentation addresses and .test domains in examples.
  • If something goes wrong, disconnect, report and write down what happened.

Next: Malware Lifecycle and the Attack Chain