Skip to content
Legal Analysis

What to Do If You Have Been Hacked in Spain: Complete Legal Guide

15 April 2026Updated: 

Key Takeaways

  • Art. 197 bis.1 CP: prison from 6 months to 2 years
  • Preserve the evidence before resetting your phone
  • A complaint by the victim is required (Art. 201 CP)
  • Bank: refund of unauthorised payments (Art. 45.1 RDL 19/2018)
  • Damages claim as a private prosecutor

If your phone or an account has been hacked, do not delete anything, keep screenshots, change your passwords from another device, turn on two-step verification, tell your bank about any transactions you do not recognise and report it to the police, the court or the Public Prosecutor's Office. Unauthorised access to an information system is punishable by six months to two years in prison (Art. 197 bis.1 CP).

Need help with your case? Talk to a criminal defence lawyer at Alonso Sala.

Discovering that someone has accessed your email, social media, bank account or phone without permission is a distressing experience. What many do not know is that hacking is a criminal offence in Spain: unauthorised access to an information system is punishable by six months to two years in prison (Art. 197 bis.1 CP). As criminal lawyers with experience in cyber offences, we explain what to do, in what order and what you can claim.

The 7 Immediate Steps If You Have Been Hacked

  1. Do not touch anything: do not delete messages, emails or history. Everything can be evidence. If the attacker left a message, capture it.
  2. Screenshots: take screenshots of everything unusual: unrecognised logins, messages sent that you did not write, password changes, connected devices. Note the date and time of each one.
  3. Change your passwords: from a secure device (not the compromised one), change the password of the affected service and turn on two-step verification. Start with your main email account, because it is the one that lets you recover all the others.
  4. Review access and unlink devices: in the security settings of each affected service, check the recent logins, note any IP addresses and locations you do not recognise, log out of all devices and remove access for third-party apps.
  5. Tell your bank if there are transactions you do not recognise: Spanish payment services law requires the user to report it without undue delay (Art. 41.b of Royal Decree-Law 19/2018), and any refund depends on that notification (Art. 43.1).
  6. Report it: to the police, the duty court or the Public Prosecutor's Office (Art. 264 LECrim). We explain below how to do it and what to provide.
  7. Speak to a criminal lawyer: a lawyer can help you set out the facts and the evidence in the complaint and join the proceedings as a private prosecutor to claim damages.

My Phone Has Been Hacked: What to Do (and What Not to Do)

Your phone holds your email, social media, banking and text-message verification codes, so access to the handset often opens the door to everything else. Common signs are apps you did not install, messages sent that you did not write, login or password-change alerts you did not request, unusually high data or battery use and, above all, the phone suddenly losing signal, which may mean someone has obtained a duplicate of your SIM card.

What to do:

  • From another trusted device, change the password of your main email account and your online banking, and turn on two-step verification.
  • Check which apps have special permissions (device administration, accessibility, reading messages) and note any you do not recognise before removing them.
  • If the phone has lost signal for no apparent reason, contact your mobile operator and your bank through their official channels, and mention it in your complaint.
  • Before restoring the phone to its factory settings, preserve the evidence: screenshots, a list of installed apps and, if the case justifies it, an expert examination. A factory reset erases precisely the traces that can help identify the person responsible.

What not to do:

  • Do not contact or negotiate with the attacker, and do not pay anyone who asks for money to give you back access or not to publish your information: there is no guarantee, and it may encourage further demands.
  • Do not hire services that promise to "recover" accounts or "trace" the attacker in exchange for an upfront payment.
  • Do not delete conversations or uninstall anything without first keeping a record of it.

Which Offences Does the Hacker Commit?

Hacking can amount to several offences under the Spanish Criminal Code. Which one applies depends on what the person does once inside:

ConductArticlePenalty
Accessing an information system without authorisation, by getting around its security measures, or remaining in it against the owner's willArt. 197 bis.1 CPPrison from 6 months to 2 years
Intercepting non-public transmissions of computer dataArt. 197 bis.2 CPPrison from 3 months to 2 years or a fine of 3 to 12 months
Seizing email messages or intercepting telecommunications to discover secrets or invade privacyArt. 197.1 CPPrison from 1 to 4 years and a fine of 12 to 24 months
Accessing confidential personal data stored on computer media, or using or altering it to the detriment of its ownerArt. 197.2 CPPrison from 1 to 4 years and a fine of 12 to 24 months
Disseminating, disclosing or passing on to third parties what was discoveredArt. 197.3 CPPrison from 2 to 5 years
Deleting, damaging or making data or programs inaccessible in a serious way and with a serious resultArt. 264.1 CPPrison from 6 months to 3 years
Obtaining, by computer manipulation, a non-consensual transfer to the detriment of another personArt. 249.1.a CPPrison from 6 months to 3 years
Demanding money under the threat of revealing facts about your private lifeArt. 171.2 CPPrison from 2 to 4 years if the money is handed over; from 4 months to 2 years if not

If the offender acts within a criminal organisation or group, the penalties for the offences in Art. 197 and the following articles are raised by one degree (Art. 197 quater CP). Where the offender also pretends to be you in dealings with third parties, depending on how it is done, the offence of usurping another person's civil status under Art. 401 CP may come into play (prison from six months to three years); if they use your image without your consent to open fake profiles on social media and thereby harass, intimidate or humiliate you, Art. 172 ter.5 CP applies (prison from three months to one year or a fine of six to twelve months); other offences are also possible, and it depends on each case. If the data reveals health, sex life, ideology or other specially protected information, or the victim is a minor or a person with a disability in need of special protection, the penalties are imposed in their upper half (Art. 197.5 CP).

How and Where to Report a Hack

A complaint can be filed with the police, the court or the Public Prosecutor's Office (Art. 264 LECrim), in writing or orally (Art. 265 LECrim), and also electronically with an electronic signature (Art. 266 LECrim). If you file it in person, you are entitled to a receipt (Art. 268 LECrim). You do not need to know who the attacker is: you report the facts and the investigation tries to identify them.

One important point: the offences of discovery and disclosure of secrets, including the unlawful access in Art. 197 bis, are only prosecuted if the aggrieved person or their legal representative files a complaint (Art. 201.1 CP). That complaint is not needed when the offence affects the general interest or a plurality of people, or if the victim is a minor or a person with a disability in need of special protection (Art. 201.2 CP). And a pardon by the victim extinguishes the criminal action (Art. 201.3 CP). In other words, without your complaint there will normally be no investigation.

What it is worth providing:

  • A timeline: when you noticed the first sign, what changed and what you did afterwards.
  • The screenshots, login alerts and any IP addresses or locations you noted down.
  • Bank statements showing the transactions you do not recognise, and the notice you gave your bank.
  • Any message from the attacker (demands, threats) and the profiles or accounts used to contact you.

If the Hack Affects Your Bank Account

When a third party has used your account or card without your authorisation, Royal Decree-Law 19/2018 on payment services provides as follows:

  • Notifying the bank: the payment can only be rectified if you report it without undue delay and, in any event, within a maximum of thirteen months from the debit date (Art. 43.1).
  • Refund: the bank must refund the amount of the unauthorised transaction immediately and, at the latest, by the end of the business day following the day on which it noted or was notified of the transaction, unless it has reasonable grounds to suspect fraud and reports them in writing to the Bank of Spain (Art. 45.1).
  • Limits: the user may have to bear up to 50 euros in certain cases, and all the losses if they acted fraudulently or failed, intentionally or through gross negligence, to meet their obligations to keep their credentials safe (Art. 46.1).

Note one distinction: if you yourself ordered the transfer or payment, even if you were deceived into doing so, the transaction is not "unauthorised" in the sense of that law, because a payment is considered authorised when the payer has given consent to it (Art. 36.1), and a different route applies. The claim goes first to the bank's customer service department and, if it is not resolved, to the Bank of Spain's complaints service. In parallel, criminal proceedings make it possible to claim what you lost from the offender; we explain how on our page for victims of online fraud.

How to Preserve Digital Evidence

Digital evidence is volatile: a login can be deleted and a log can be overwritten. For it to be usable at trial:

  • Do not handle the compromised device: if possible, do not use it until an expert has examined it.
  • Notarial record: a notary can certify the content of a website, an email or a profile at a given moment.
  • Forensic copy: a forensic IT expert can make a complete copy (forensic image) of the device and calculate its digital fingerprint (hash), which later makes it possible to check that nothing has changed. It is the same logic as the chain of custody required for any piece of evidence.
  • Provider records: online services keep access logs with IP addresses. The Public Prosecutor's Office or the Judicial Police can require them to be preserved until a judge authorises their disclosure, for a maximum of ninety days, extendable once up to one hundred and eighty days (Art. 588 octies LECrim). That is why it pays to report early.

Can I Claim Damages From the Hacker?

Yes. As a private prosecutor (a victim who joins the criminal proceedings as a party), you can claim:

  • Financial loss: money taken, the cost of recovering your accounts, IT expert reports.
  • Moral damage: distress, anxiety, harm to your reputation. The amount depends on each case.
  • Loss of earnings: if the hack affected your business, the income you did not receive.

To join the proceedings, the injured party must do so before the stage at which the charges are formally set out (Art. 110 LECrim); if they arrive later, they can only adhere to the prosecution already brought. Even if they do not join, the civil claim is deemed to be brought together with the criminal action unless they waive it or reserve it for separate civil proceedings (Art. 112 LECrim).

When Are Criminal Proceedings Worth It?

Not every incident justifies lengthy proceedings. As a general guide:

  • They are usually worthwhile when money has been lost, when the attacker has accessed messages, photographs or intimate data, when they demand something from you, when they disseminate what they obtained or when the access is repeated.
  • It is worth thinking it over calmly when the account has already been recovered, there have been no losses or dissemination and there is nothing that could help identify the attacker. Even so, a complaint puts the facts on record, and that record may help you with your bank or if your data is later misused.
  • Bear in mind that, when the connection data is held by providers in other countries, the investigation may need international judicial cooperation and take longer.

Has Your Company Been Hacked?

If the hack affects personal data of clients or employees, the company has additional obligations as data controller:

  • Notification to the Spanish Data Protection Agency (AEPD): without undue delay and, where feasible, not later than 72 hours after having become aware of the breach, unless it is unlikely to result in a risk to people's rights and freedoms; if the notification is made later, it must give the reasons for the delay (Art. 33.1 of the General Data Protection Regulation).
  • Communication to those affected: without undue delay, when the breach is likely to result in a high risk to their rights and freedoms (Art. 34.1 of the same Regulation).
  • Criminal complaint: the company may be the victim of ransomware, industrial espionage or sabotage.
  • Cyber insurance: if the company has a cyber policy, check its conditions for notifying a claim and activate it as soon as possible.

Frequently Asked Questions

Can the hacker go to prison?

Yes. Unlawful access under Art. 197 bis.1 CP carries a prison sentence of six months to two years; seizing messages or data to discover secrets carries one to four years and a fine (Art. 197.1 and 2 CP); causing serious damage to data or systems carries six months to three years (Art. 264.1 CP). For the offences in Art. 197 and the following articles, acting within a criminal organisation or group raises the penalty by one degree (Art. 197 quater CP); for computer damage, acting within a criminal organisation raises the penalty to two to five years in prison and a fine of one to ten times the damage caused (Art. 264.2.1.ª CP).

And if the hacker is in another country?

You can still report it. The investigation may need international judicial cooperation to obtain data from foreign providers or to identify the person responsible, which usually makes it take longer.

Is it an offence to get into another person's phone without their permission?

Yes, even if it is your partner or a relative. Accessing it without authorisation by getting around its security measures falls under Art. 197 bis.1 CP, and reading their messages to learn about their private life, under Art. 197.1 CP. As with the whole of this chapter of the Code, a complaint by the person affected is required (Art. 201 CP).

Do not delete anything. Do not touch the device. You can call us on +34 91 078 65 74 for an initial assessment of your case.

Official text: article 197 bis of the Spanish Criminal Code (BOE)

Frequently asked questions

Is hacking a criminal offence in Spain?

Yes. Unlawful access to a computer system is an offence under Art. 197 bis.1 CP, punishable by six months to two years in prison. Depending on what the attacker does, it may be combined with discovery of secrets (Art. 197 CP), computer damage (Art. 264 CP), computer fraud (Art. 249.1.a CP) or blackmail (Art. 171.2 CP).

What should I do immediately after discovering I've been hacked?

Do not delete or alter anything, because it can all be evidence. Take screenshots of unrecognised logins, messages and changes; change your passwords from a secure device and turn on two-factor authentication; log out of all devices and revoke third-party app access; and report it as soon as possible.

Can I report a hack if I don't know who did it?

Yes. You report the facts even if the person responsible is unknown, and the police investigation tries to identify them from IP addresses and other digital traces. That is the usual way to start.

How is digital evidence properly preserved for a criminal case?

By not handling the compromised device until an expert examines it, obtaining a notarial record of the web content, making a forensic copy with its digital fingerprint (hash) so that its integrity can be checked, and reporting early, because the Public Prosecutor's Office or the Judicial Police can require the provider to preserve its records until a judge authorises their disclosure (Art. 588 octies LECrim).

Can I claim compensation from the person who hacked me?

Yes. By joining the proceedings as a private prosecutor you can claim financial loss (money taken, account recovery costs, expert fees), moral damage for the intrusion into your privacy and loss of earnings if the hack affected your business.

My phone has been hacked. What should I do?

From another device, change the password of your main email account and your online banking and turn on two-step verification; close any open sessions and check which apps have special permissions. Before resetting the phone, keep screenshots and, if necessary, an expert examination. If your phone has suddenly lost signal, tell your mobile operator and your bank, and report it.

Will the bank refund my money if my account has been hacked?

If a third party used your account without your authorisation, the bank must refund the amount by the end of the business day following notification at the latest, unless it has reasonable grounds to suspect fraud and reports them to the Bank of Spain (Art. 45.1 of Royal Decree-Law 19/2018). You must report it without undue delay and within thirteen months at most (Art. 43.1). If you ordered the payment after being deceived, different rules apply.

Where do I report a hack?

To the police, the court or the Public Prosecutor's Office (Art. 264 LECrim), in writing, orally or electronically with an electronic signature (Arts. 265 and 266 LECrim). It helps to provide a timeline, screenshots, login alerts, IP addresses and the statements showing the transactions you do not recognise.

Does the unauthorised access to my account need my complaint to be investigated?

As a general rule, yes. Art. 201.1 CP requires a complaint by the aggrieved person or their legal representative to prosecute the offences of discovery and disclosure of secrets, including unauthorised access to systems. It is not needed if the offence affects the general interest or a plurality of people, or if the victim is a minor or a person with a disability in need of special protection.

What obligations does a company have if customer or employee data was hacked?

As data controller, it must notify the Spanish Data Protection Agency without undue delay and, where feasible, not later than 72 hours after having become aware of the breach, unless it is unlikely to result in a risk (Art. 33.1 GDPR); inform those affected when the breach is likely to result in a high risk to them (Art. 34.1 GDPR); and consider filing a criminal complaint.

Do you need criminal defence in this area?

We are criminal defence lawyers specialising in cybercrime and technological criminal law. We act urgently to protect your rights.

View expertise

This page is for information purposes only and does not constitute legal advice: every case requires individual assessment. How this content is produced and verified: editorial policy.

Related Articles

View all

Before you act, speak to a criminal defence lawyer.

What you read here is just the beginning. Transform information into active defence by contacting our team of experts.