Loi 05-20: audit your betting or lottery app before it goes live.
Morocco has no gambling regulator that licenses private operators: sports betting is run by MDJS, horse-race betting by SOREC and the national lottery by SGLN, all three listed by the Ministry of Economy and Finance among public establishments and enterprises. As public enterprises, they come under Loi 05-20 on cybersecurity, which asks that any information system offering digital services to third parties be security audited before it goes live and audited regularly, and under the DGSSI's national directive, which asks for security tests during development. Ostorlab scans your app on each release and, when depth matters, pentests it and the APIs behind it.
The Moroccan texts behind a state betting or lottery app
No gambling-specific text sets security rules for betting or lottery apps in Morocco. The duties come from general cybersecurity and data protection law that covers public enterprises, and from the operators' own certifications. The dates below come from the texts and from the operators' own documents.
28 March 1972
National lottery convention
The State and the Caisse de Dépôt et de Gestion sign the convention under which SGLN organises and runs the national lottery, in application of Loi 23-71 on the national lottery (Bulletin officiel of 5 April 1972) and decree n° 2-72-310 on its management and control, as SGLN's terms for eloterie.ma recall (French text).
18 February 2009
Personal data law 09-08
Dahir n° 1-09-15 promulgates Loi 09-08 on the protection of individuals with regard to the processing of personal data, published in Bulletin officiel n° 5714 of 5 March 2009. Data controllers must protect personal data with appropriate technical and organisational measures (French text).
10 March 2014
First national directive
The first Directive Nationale de la Sécurité des Systèmes d'Information (DNSSI) is put into application by circular n° 3/2014 of the Head of Government, to raise and harmonise the security of public bodies' information systems (French text).
25 July 2020
Cybersecurity law 05-20
Dahir n° 1-20-69 promulgates Loi 05-20 on cybersecurity, published in Bulletin officiel n° 6906 of 6 August 2020. It covers the information systems of public establishments and enterprises and comes into force when its implementing texts are published (French text).
15 July 2021
Implementing decree 2-21-406
The decree names the DGSSI as national cybersecurity authority, sets the A to D classification of information systems, the audit domains including penetration testing and source code audit, and the qualification of audit providers. Entities have 12 months from its publication to classify their systems and declare sensitive ones to the DGSSI (French text).
22 October 2024
Cloud decree 2-24-921
Entities that use cloud services for sensitive information systems or sensitive data must use a cloud provider qualified by the DGSSI. The decree is published in Bulletin officiel n° 7380 of 20 February 2025 (French text).
23 January 2026
MDJS renews ISO 27001 and WLA-SCS
MDJS announces that, after an audit by Bureau Veritas, its information security management system supporting development, marketing, sales and operations was found compliant with ISO/IEC 27001:2022 and the World Lottery Association Security Control Standard, version 2024 (French text).
The Moroccan rules at a glance
Who it applies to
MDJS (sports betting), SOREC (horse-race betting) and SGLN (national lottery, online through eloterie.ma), as public enterprises, and the suppliers who build or run their platforms under contract
Key dates
Loi 05-20 promulgated 25 July 2020; implementing decree n° 2-21-406 of 15 July 2021; cloud decree n° 2-24-921 of 22 October 2024
Focus
A security audit before go-live and regular audits, classification of sensitive systems, secure development and testing, vulnerability management, supplier contracts and player data
Main reference
Loi n° 05-20 relative à la cybersécurité, decree n° 2-21-406 and the DGSSI's Directive Nationale de la Sécurité des Systèmes d'Information (DNSSI)
Moroccan law, applied to a state betting app
For each rule: what the text says, what it means for a betting or lottery app run by MDJS, SOREC or SGLN, how Ostorlab helps, and what stays with the operator, its auditors and the authorities.
Loi 05-20 applies to the information systems of State administrations, local authorities, public establishments and enterprises and other public-law bodies, together called "entités". Each entity must identify the risks to its information systems and take the technical and organisational measures to manage them. Any information system of an entity "offrant des services numériques à des tiers" (offering digital services to third parties) must have a security audit before it is put into operation, and each entity must audit its information systems regularly.
What it means for your app
MDJS and SOREC are on the Ministry of Economy and Finance's list of public establishments and enterprises, and SGLN is listed among the public establishments and enterprises under the State's financial control. An online betting or lottery app and the platform behind it offer a digital service to players, so a new app or platform needs its security audit before launch, and audits after that.
How Ostorlab helps
An AI-agent pentest tests the app and its APIs behind login, on the build you ship, with a working exploit you can replay for each AI-agent finding. Routine scans run on each release in between.
What stays with you
Commissioning the pre-launch and periodic audits, choosing the auditor, and deciding when a system may go live.
Classify the platform and declare sensitive systems
What the text says
Entities classify their information systems from an analysis of the impact of incidents on confidentiality, availability or integrity, on a four-level scale. Systems in class A or B are sensitive, and each entity must declare its sensitive systems to the national authority, the DGSSI. The classification is reviewed at least every three years and whenever needed. Entities had 12 months from the decree's publication to classify and declare.
What it means for your app
The classification decides which audit rules apply to the betting or lottery platform and the back end of the app. Systems that hold player accounts, stakes, tickets and payouts are the ones the impact analysis looks at first.
How Ostorlab helps
Ostorlab does not classify systems. Its findings on each release show what the app stores on the device, which components it ships and how its APIs behave, which can feed the impact analysis.
What stays with you
The impact analysis, the classification, its three-yearly review and the declaration to the DGSSI.
Audit sensitive systems by domain, including penetration tests
What the text says
Entities and vital infrastructures audit the security of their sensitive systems in the domains listed in annex 2 of the decree, where the systems lend themselves to it, with no more than three years between audits of the same domain. The domains include source code audit and the "test d'intrusion", which simulates the real conditions of an attack to find vulnerabilities and check their exploitability and impact. These audits are carried out under a contract with an audit provider qualified by the DGSSI for at most three years; the list of qualified providers is published in the Bulletin officiel and on the DGSSI site, and the audited entity keeps the report for at least three years.
What it means for your app
If the betting platform is classified sensitive, its app and APIs fall in the penetration test and source code audit domains, each audited at least every three years by a qualified provider. A lot of releases ship between two audits.
How Ostorlab helps
Ostorlab does not perform the qualified audit. Between audits it scans each release, and AI agents pentest the app and its APIs when depth matters, so known issues are fixed before the auditor starts.
What stays with you
Choosing a DGSSI-qualified audit provider, the audit contract, the audit report and keeping it for three years.
The DNSSI applies to the information systems of public establishments and enterprises and of vital infrastructures, and to the third parties who work on them. Security must be part of every phase of a project, from a risk assessment at the start to security verification "intégrée dans les tests d'acceptation". Each entity must have a secure development policy in line with DGSSI guides and run security tests during the development cycle. When changes are made, it must review and test critical business applications for any impact on the activity or on security.
What it means for your app
Each app release is a change to a critical business application. Its security check belongs in the release's acceptance tests, not only in the periodic audit.
How Ostorlab helps
Mobile SAST analyses the APK, AAB or IPA directly, with no source code needed, and Mobile DAST runs the app. Both run on each release from your CI/CD pipeline, and findings are retested once the fix ships.
What stays with you
The secure development policy, acceptance criteria, release approval and the annual DNSSI compliance review.
Authenticate every user and restrict privileged access
What the text says
Access to networks, operating systems and applications must go through individual identification and authentication. Systems and applications must be protected by suitable access restrictions, such as login and password, strong authentication, filtering rules and connection time windows, in line with the entity's access control policy. Access to administration tools and interfaces is limited to authorised people, and each entity sets a password policy covering complexity, renewal and reset.
What it means for your app
On a betting app, login, account recovery and sessions are where accounts and balances are taken over. These checks have to hold on the server, even when someone calls the API without the app.
How Ostorlab helps
Ostorlab completes SMS, email or TOTP one-time codes with your test accounts and tests MFA enforcement and step-up flows, together with the API calls behind them, and tests login and logout, token refresh, timeouts and session invalidation.
What stays with you
The access control and password policies, the choice of strong authentication and access to the back office.
Each entity must identify the files and transactions that need protection by encryption or electronic signature at the level of the application architecture. Where cryptography is used, a policy sets the requirements for certificates, algorithms, key lengths and the protocols allowed for encrypted connections, and a procedure governs keys through their whole life cycle, from generation and storage to destruction.
What it means for your app
Stakes, tickets, payouts, deposits and withdrawals pass through the app's API calls. They should be protected in transit, and the server should not trust amounts or results the app sends.
How Ostorlab helps
Ostorlab intercepts the app's traffic even with TLS pinning, checks transport protections, and tests authorization and business logic in the APIs behind bets, tickets, deposits, withdrawals and accounts. It also finds keys and credentials left in the app package.
What stays with you
Deciding which transactions need encryption or signature, the cryptography policy and key management on your servers.
Each entity must be informed in time of technical vulnerabilities in its systems, assess its exposure and act on the risk, under a procedure that covers the asset inventory, roles, intervention deadlines and how fixes are applied. Vulnerabilities judged critical must be brought to the DGSSI's attention. Each entity also sets a policy for following and applying security patches, with a process for each system or application.
What it means for your app
An app release bundles SDKs and libraries, including payment, identity and analytics SDKs. An outdated component is a known vulnerability shipped to every player's phone.
How Ostorlab helps
Ostorlab lists the SDKs and native libraries in each release with their versions and their location in the app bundle, maps them to known vulnerabilities, and gives you an SBOM for every release.
What stays with you
The vulnerability procedure and deadlines, patching servers and infrastructure, and deciding which vulnerabilities are critical and reported to the DGSSI.
A provider to whom a sensitive information system is outsourced must follow the DGSSI's rules and technical referentials, sensitive data must be hosted only in Morocco, and the outsourcing contract must be under Moroccan law with commitments on information protection, auditability, reversibility, security requirements and service levels. Under the DNSSI, contracts set the entity's security requirements, suppliers must follow its security policy, and their services are monitored, reviewed and audited at regular intervals. Sensitive systems or data placed in the cloud require a cloud provider qualified by the DGSSI.
What it means for your app
When a supplier builds or runs the app or platform, as a private operator runs eloterie.ma for SGLN, the contract should give the operator the right to audit it and require it to follow the operator's security policy. Test results on each delivered build are a practical way to check what you receive.
How Ostorlab helps
Mobile SAST analyses each build a supplier delivers, as an APK, AAB or IPA or from the store, with no source code needed, and Mobile DAST runs it, so you can check a release before it reaches players.
What stays with you
Contract clauses, supplier audits, hosting location and the choice of qualified cloud providers.
Secure players' personal data and get the right CNDP clearance
What the text says
The data controller must implement appropriate technical and organisational measures to protect personal data against accidental or unlawful destruction, loss, alteration, disclosure or unauthorised access, in particular when processing involves transmission over a network, and a processor is bound by a contract that extends these duties to it. Processing that includes "le numéro de la carte d'identité nationale" (the national ID card number) needs the CNDP's prior authorisation; other processing needs a prior declaration. Personal data may go to a foreign State only if it ensures a sufficient level of protection, on the list set by the CNDP, or under the exceptions of article 44, such as the person's express consent, a contract with the person, or an express authorisation from the CNDP.
What it means for your app
Player accounts and payouts can involve the CIN, account details and payment information, which sit in the app and travel through its APIs. They should not be left in clear text on the phone, in logs or in screenshots, and data an SDK sends to servers abroad can be a transfer that needs a CNDP filing.
How Ostorlab helps
Ostorlab looks for tokens and personal data in local storage, caches, logs and screenshots, checks transport protections, and lists the third-party SDKs each release ships.
What stays with you
The CNDP authorisation, declarations and transfer filings, processor contracts and data protection on your servers.
Verify the app against the DGSSI application referential
What the text says
The DGSSI's application security verification referential, based on OWASP ASVS 4.0.3, sets 286 controls in 14 areas, including authentication, session management, access control, data protection, communications, business logic and APIs and web services. Each organisation picks level 1, 2 or 3 from its risk analysis; level 2 suits applications that handle important transactions or sensitive assets, and level 1 tests can run without the source code. The DGSSI strongly encourages SAST and DAST tools in the development pipeline, and notes that business logic flaws and access control tests usually need human assistance. Under the DNSSI, security tests during development follow the entity's policy and the DGSSI's guides and referentials.
What it means for your app
A betting or lottery app moves money and holds player accounts, which points to level 2 or above. The referential gives a shared checklist for your own tests, for suppliers' deliveries and for tender requirements.
How Ostorlab helps
Mobile SAST and DAST run on each release in the pipeline. AI agents test authorization and business logic in the app and its APIs behind login, with a working exploit you can replay for each AI-agent finding.
What stays with you
Choosing the verification level, mapping findings to the referential's controls, and the manual reviews and audits the referential expects.
Summary of Loi 05-20, decrees n° 2-21-406 and n° 2-24-921, the DGSSI's DNSSI and application verification referential, Loi 09-08 and CNDP guidance, in French, checked on 3 December 2026. Morocco has no gambling regulator licensing private operators, and none of these texts is a gambling regulation: they apply to MDJS, SOREC and SGLN as public enterprises, which is our reading of the texts. This page is not legal advice.
Moroccan rules, control by control
The controls the Moroccan texts point to, how Ostorlab tests them in a betting or lottery app and its APIs, and the evidence you can keep.
How Ostorlab helps
AI-agent pentest of the app and its APIs, behind login, on the build you ship.
Evidence you keep
A working exploit you can replay for each AI-agent finding, and a coverage heatmap
Intercepts the app's traffic even with TLS pinning, and tests authorization and business logic in the APIs behind bets, tickets, deposits and withdrawals.
Evidence you keep
Request and response evidence for each API finding
Ostorlab tests controls in the app and its APIs. Classification and declaration of sensitive systems, audits by DGSSI-qualified providers, homologation where a system belongs to a vital infrastructure, the RSSI, incident declaration to the DGSSI, CNDP authorisations and transfer filings, hosting and cloud choices, game, draw and result integrity, and the operators' ISO 27001 and WLA certifications stay with MDJS, SOREC, SGLN, their auditors and the authorities. Texts checked on 3 December 2026. This page is not legal advice.
Moroccan controls to test in a state betting or lottery app
A practical list for security and compliance teams at MDJS, SOREC and SGLN and at the suppliers who build or run their apps, based on Loi 05-20, its decree, the DNSSI, the DGSSI application referential and Loi 09-08.
1
Know which rules apply
Confirm with your legal team that your company is an entity under Loi 05-20, how the betting platform is classified, and whether any system has been designated part of a vital infrastructure.
2
Audit before launch
Put each new app, major version or platform through its security audit before it goes live, and keep the report.
3
Track the audit cycle
For sensitive systems, track the last audit in each domain, including penetration testing and source code audit, so none is more than three years old.
4
Scan each release
Run Mobile SAST and DAST on each release as part of the acceptance tests, and retest once fixes ship.
5
Pick a verification level
Choose the DGSSI application referential level for the app, usually level 2 or above for an app that moves money, and use its controls in acceptance tests and supplier contracts.
6
Logins, bets and payouts
Verify on the server that login, account recovery, deposits, bets and withdrawals require the right authentication, and that one account cannot reach another's data or balance.
7
Data, keys and components
Check storage, caches, logs and transport for personal data, the app package for keys and credentials, and each release's SBOM for outdated components.
8
Evidence for auditors
Keep scan results, exploit evidence and retest results with each release, ready for the qualified auditor, the annual DNSSI review and supplier reviews.
A suggested list, not a template from the DGSSI, the CNDP or the operators. Texts checked on 3 December 2026. This is not legal advice.
Sources
The official texts this page is based on, checked on 3 December 2026.
Loi n° 05-20 relative à la cybersécurité(opens in a new tab)Promulgated by dahir n° 1-20-69 of 25 July 2020, Bulletin officiel n° 6906 of 6 August 2020. Scope (1), entities' security policy, pre-launch and regular audits (3, 4), incident declaration (8), outsourcing and hosting (10 to 12), vital infrastructures (14 to 25), fines (49, 50) and entry into force (53). Ministry of Justice consolidated text (French text)
Décret n° 2-21-406 du 15 juillet 2021(opens in a new tab)Implementing decree of Loi 05-20, French edition in Bulletin officiel n° 7028 of 7 October 2021. DGSSI as national authority (1), DNSSI (9), classification (10 to 15), vital sectors (18 and annex 1), audit providers and audits (20 to 33 and annex 2) and the 12-month deadline (43) (French text)
Décret n° 2-24-921 du 22 octobre 2024(opens in a new tab)Use of cloud providers by entities and vital infrastructures with sensitive systems or data, Bulletin officiel n° 7380 of 20 February 2025. Qualified providers required (1, 2) (French text)
Rapport sur les établissements et entreprises publics, PLF 2027(opens in a new tab)Ministry of Economy and Finance report accompanying the 2027 finance bill. Annex 1 lists 274 public establishments and enterprises, with MDJS and SOREC among the 59 sociétés anonymes; annex 8 lists SGLN among the public establishments and enterprises under the State's specific financial control (French text)
MDJS: Notre mission(opens in a new tab)La Marocaine des Jeux et des Sports, created in 1962, a state lottery holding the monopoly on betting on sports competitions in Morocco except horse and greyhound races; its ISO 27001 and WLA security certifications (French text)
SOREC: Jeux hippiques(opens in a new tab)Société Royale d'Encouragement du Cheval, exclusive operator of pari mutuel betting on horse races since the transfer of racing activities in 2007, with an online betting platform (French text)
Loterie Nationale: Certifications internationales(opens in a new tab)SGLN statement that it maintains ISO 27001 (version 2013) certification for all its activities, first obtained in December 2014, and its WLA Security Control Standards certification, and holds WLA responsible gaming level 4 (French text)
FAQ
Frequently asked questions
Straight answers on coverage, setup, and how results reach your team.
Not one that licenses private operators. MDJS states that it holds the monopoly on betting on sports competitions in Morocco, except horse and greyhound races; SOREC states that it has been the exclusive operator of pari mutuel betting on horse races since 2007; and SGLN runs the national lottery under Loi 23-71 and a 1972 convention between the State and the Caisse de Dépôt et de Gestion. We found no gambling-specific text setting security or testing rules for their apps. The duties on this page come from general cybersecurity and data protection law.
Loi 05-20 covers the information systems of public establishments and enterprises. The Ministry of Economy and Finance's report on public establishments and enterprises for the 2027 finance bill lists MDJS and SOREC among the public sociétés anonymes in its main list, and lists SGLN, a company of the Caisse de Dépôt et de Gestion group, among the public establishments and enterprises under the State's specific financial control. That makes all three entities under the law in our reading; confirm it with your legal team, especially for SGLN, which does not appear in the main list.
We cannot tell. Under article 16 of Loi 05-20, vital infrastructures are designated sector by sector and the list must be kept secret. If a system is part of a vital infrastructure, further rules apply, such as homologation of sensitive systems before they go live and audits by the DGSSI or qualified providers at its request. The entity rules on this page apply either way.
No. Ostorlab does not perform the pre-launch or periodic audit, and its reports do not replace an auditor's. Audits of sensitive systems under decree n° 2-21-406 are carried out by audit providers qualified by the DGSSI, whose list is published in the Bulletin officiel and on the DGSSI site. Ostorlab tests your app and its APIs on each release and between audits, so you go into them with known issues fixed.
We found no Moroccan text that requires it. MDJS states that it holds ISO/IEC 27001:2022 and the World Lottery Association Security Control Standard, version 2024, renewed after an audit by Bureau Veritas. SGLN states that it maintains ISO 27001 (version 2013) for all its activities and the WLA Security Control Standards certification; its WLA level 4 is a responsible gaming certification, not a security one. We found no comparable statement from SOREC. These certifications are run by the operators and their certification bodies, not by Ostorlab.
Yes. Under article 12 of Loi 09-08, processing of data that includes the national ID card number needs the CNDP's prior authorisation, filed with the CNDP's prior authorisation form; other processing needs a prior declaration. Transfers of player data abroad need a sufficient level of protection in the destination country or one of the article 44 exceptions, and are filed with the CNDP's transfer form. SGLN's data charter for eloterie.ma, for example, cites a CNDP authorisation and transfer authorisations.
Each entity must appoint a head of information systems security (RSSI), who is the DGSSI's contact, and must declare to the DGSSI any incident affecting the security or operation of its information systems as soon as it learns of it, giving further information on request. The DGSSI's maCERT publishes the declaration form and procedure; the law sets no deadline in hours. Failing the incident declaration obligations is punished by a fine of 100,000 to 200,000 dirhams. The RSSI, incident detection and declaration stay with the operator.
At a minimum, you can search for your application on the App Store or Google Play and run a free, fast scan on ostorlab.co with no login required. Or provide the mobile artifact (APK, AAB or IPA). For deeper coverage of authenticated flows, add test credentials before running a full scan.
Test your betting or lottery app before and between Moroccan audits
Start with a free scan of your app from the store, or book a demo to run logged-in tests of your app and APIs with our team.