Skip to content

Commit 43fd974

Browse files
committed
updates and fixes
1 parent fe0e6f7 commit 43fd974

16 files changed

Lines changed: 66 additions & 56 deletions

donate.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ To help more people kickstart their Infosec journey, this course is offered on a
44

55
Why contribute? Your donations directly fund the ongoing maintenance, updates, and development of new high-quality security resources.
66

7-
Our Mission: To [simplify cybersecurity](https://simplifysecurity.nocomplexity.com) and ensure high-level training remains a public good, not a gated commodity.
7+
Our Mission: To [simplify cybersecurity](https://simplifysecurity.nocomplexity.com) and transform elite training into a public good, rather than a gated commodity.
8+
89

910
If you find this material valuable, please consider supporting our mission.
1011

index.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@ The aim of this course is to teach you how to carry out security testing on Pyth
1919
:::
2020

2121

22-
This course is designed for developers and security enthusiasts, taking you from basic code hygiene through to advanced automated security analysis. It focuses on reliable open-source security tools to identify vulnerabilities arising from Python’s dynamic nature and the common pitfalls in its ecosystem.
22+
This course is designed for developers and security enthusiasts, taking you from basic code hygiene through to advanced security analysis. It focuses on using reliable open-source security tools to identify vulnerabilities arising from Python’s dynamic nature and the common pitfalls in its ecosystem.
2323

2424
:::{note}
2525
This course assumes a basic familiarity with Python syntax and the command line.
2626
:::
2727

28-
It is designed to take you from a security novice to a proficient code auditor. Rather than focusing solely on theory, we will take a practical approach—identifying and resolving vulnerabilities in **Python code** using **Static Application Security Testing (SAST)** tools.
28+
It is designed to take you from a security novice to a proficient security code auditor for Python applications. Rather than focusing solely on theory, we will take a practical approach—identifying and resolving vulnerabilities in **Python code** using **Static Application Security Testing (SAST)** tools.
2929

3030

3131
## Who is this course for?
3232

33-
This course is designed for software security testers who want to improve their knowledge and skills in security testing for Python software.
33+
This course is designed for security testers who want to improve their knowledge and skills in security testing for Python software.
3434

3535
It is also suitable for DevOps professionals, architects, security professionals, AppSec engineers, software engineers, web application developers, and others interested in learning about security testing for Python software.
3636

3737
The course focuses on practical steps that can be taken — even with limited resources — to build your skills in security testing for Python software and performing security audits on systems that include Python components.
3838
This is not a beginner’s course that simply teaches you to run tools and follow a checklist.
3939
To get the most from this course (and to complete it successfully), you should already be familiar with:
4040

41-
- software testing
42-
- using programs from the command-line interface (CLI) on Unix-like systems (Linux or BSD)
41+
- Security testing
42+
- Using programs from the command-line interface (CLI) on Unix-like systems (Linux or BSD)
4343

4444
:::{tip}
4545
Some prior knowledge and experience with security testing is strongly recommended.
4646
:::
4747

4848
:::{note}
49-
This course is **not** a beginner’s course, but aims to **deepen the knowledge of professional security testers** in relation to systems built with (or containing) Python code.
49+
This course is **not** a beginner’s course, but aims to **deepen the knowledge of professional security testers** in relation to systems built with (or containing) **Python** code.
5050
:::
5151

5252
## Course Overview
@@ -60,8 +60,7 @@ Overview of modules:
6060

6161
+++
6262

63-
3. [Module 3](module3/module3_overview): Harnessing Static Application Security Testing (SAST) for Python Code
64-
Deep coverage of Python Code Audit, the advantages of a SAST for Python code, and use cases.
63+
3. [Module 3](module3/module3_overview): Harnessing Static Application Security Testing (SAST) for Python Code and why humans are stil crucial for security testing .
6564

6665
+++
6766

@@ -70,7 +69,7 @@ Deep coverage of Python Code Audit, the advantages of a SAST for Python code, a
7069
+++
7170

7271

73-
5. [Module 5](module5/module5_overview): Detecting and Exploiting Common Python Vulnerabilities with **Python Code Audit**.
72+
5. [Module 5](module5/module5_overview): Detecting and Exploiting Common Python Vulnerabilities with [**Python Code Audit**](https://nocomplexity.com/codeaudit/).
7473

7574
+++
7675

module1/pythonexecutionmodel.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ Below is an example how you can see how Python code is compiled to bytecode:
6060

6161
## Memory Abstraction in Python: Security Benefits and Trade-offs
6262

63-
Unlike lower-level languages such as C or C++, Python does not allow developers to directly manipulate memory addresses. There are no pointers that can be arbitrarily dereferenced, and memory allocation and deallocation are handled automatically by the runtime. This abstraction significantly reduces the risk of certain low-level vulnerabilities.
64-
Reduced Risk: **Buffer Overflows**
63+
Unlike lower-level languages such as C or C++, Python does not allow developers to directly manipulate memory addresses. There are no pointers that can be arbitrarily dereferenced, and memory allocation and deallocation are handled automatically by the runtime. This abstraction significantly reduces the risk of certain low-level vulnerabilities, like **Buffer Overflows**.
6564

6665
In languages like C, developers must manually manage memory buffers. A common vulnerability is a buffer overflow, where data written beyond the bounds of an allocated buffer overwrites adjacent memory. This can lead to crashes or, in severe cases, arbitrary code execution.
6766

@@ -109,7 +108,7 @@ Although this does not corrupt memory, it can allow an attacker to execute arbit
109108

110109
3. **Reliance on Native Extensions**
111110

112-
While Python itself is memory-safe, many performance-critical libraries (e.g. NumPy, cryptographic libraries) are written in `C`. Vulnerabilities in these native extensions can reintroduce classic memory issues such as buffer overflows.
111+
While Python itself is memory-safe, many performance-critical libraries (e.g. `NumPy`, cryptographic libraries) are written in `C`. Vulnerabilities in these native extensions can reintroduce classic memory issues such as buffer overflows.
113112

114113
Example:
115114
- A Python application calls a vulnerable C extension.

module1/pythonsecuritymodel.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ These mechanisms prevent many classic memory exploitation techniques. However, t
3333
* Denial-of-service risks through excessive object creation
3434
* Abuse of large in-memory data structures
3535

36-
Python protects against direct memory manipulation, but it does not protect against logic flaws or resource misuse.
36+
Python protects against direct memory manipulation, but it does **not protect against logic flaws or resource misuse**.
3737

3838

3939

@@ -105,7 +105,7 @@ Protecting against malware therefore requires:
105105

106106
### No Built-in Sandbox
107107

108-
It is important to understand that Python does not provide a secure sandbox environment for executing untrusted code. Attempts to “restrict” Python by removing certain built-ins or blocking modules are generally insufficient and can often be bypassed.
108+
It is important to understand that Python **does not** provide a secure sandbox environment for executing untrusted code. Attempts to “restrict” Python by removing certain built-ins or blocking modules are generally insufficient and can often be bypassed.
109109

110110
True isolation must be implemented at the operating system or infrastructure level, for example using:
111111

@@ -131,5 +131,9 @@ Understanding Python’s internal execution model, memory handling, and dynamic
131131

132132

133133
:::{note}
134-
**Strong security in Python is not automatic — it is engineered.**
134+
**Strong security for Python applications is not automatic — it is engineered.**
135+
:::
136+
137+
:::{caution}
138+
Many Python frameworks prioritize ease of use over strict security in their default configurations (e.g., debug mode in Flask/Django). Moving to a "hardened" production state is a manual, engineered process.
135139
:::

module2/ai_testing.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ short_title: Security testing and AI
77
Many people advocate for the use of AI technology , like AI agents, for Python security testing.
88

99
:::{warning}
10-
Most are just far from good enough. In the best case scenario, you’ll only be disappointed. But the risk of a false sense of security is enormous.
10+
Most are just far from good enough. In the best case scenario, you’ll only be disappointed. But the risk of a **false sense of security** is enormous.
1111
:::
1212

13-
So why should you not use AI powered security test tools for Python?
13+
So why should you not use or fully trust on AI powered security test tools for Python?
1414
- **No single tool can judge the context** where a program is used, how it is used and by whom. There is a large difference between using a e.g. a SAST scanner on code from a developer perspective, or to use a SAST scanner as a potential user of some Python software. Based on findings you will and must judge risks differently. Judging risks is always context dependent and can still not be automated.
1515

1616
+++
@@ -33,4 +33,12 @@ AI and ML technologies can support cyber security, particularly in areas such as
3333
When AI technology is used, strict reproducibility cannot always be guaranteed due to its probabilistic nature.
3434
:::
3535

36-
Cyber security professionals should be conservative with adopting new IT hypes for security testing tools. IT hypes like AI-agents and LLMs are not the holy grail for solving our cybersecurity problems. This is because in the end you always pay more for cyber security solutions, but the risks still remain. Cyber security is not a product, but a process.
36+
Creating security products that ‘learns’ from patterns is not new for security. AI/ML technologies have been applied for many years. For example for HIDS systems and spam-filters. Applying AI for cyber security has been done for many years with variable success and still most AI/ML powered security systems are not mature and can not be fully trusted.
37+
38+
39+
Cyber security professionals should be conservative with adopting new IT hypes and innovations for security testing tools. IT hypes like AI-agents and LLMs are not the holy grail for solving our cybersecurity problems. This is because in the end you always pay more for cyber security solutions, but the risks still remain.
40+
41+
:::{important}
42+
Cyber security is not a product, but a process.
43+
:::
44+

module2/fosstestsoftware.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ Some core benefits of using FOSS software for security testing of Python code in
1616
* **Easier access to expertise and resources:** Some specialist security testing tools require in-depth knowledge and experience. Many FOSS Python security tools are widely adopted, making expertise more readily available when required.
1717

1818
:::{warning}
19-
Ensure that the software you use is genuinely open source and distributed under a valid OSI-approved FOSS licence. Avoid tools that claim to be open source in name only.
19+
Ensure that the test software you use for security testing is genuinely open source and distributed under a valid [OSI-approved](https://opensource.org/) FOSS licence. Avoid using tools that claim to be open source in name only.
2020
:::
2121

22+
Open source in name only" (often called OSINO or Openwashing) refers to software that uses the "open source" label for marketing but fails to provide the actual freedoms associated with it—such as the right to modify, redistribute, or use the code without restrictive commercial licenses. Some disadvantages are:
23+
1. Vendor Lock-In and False Autonomy
24+
While these tools appear to give you control, they often include "poison pill" clauses or proprietary dependencies. If the vendor changes their pricing, goes bust, or stops supporting the product, you are left with a codebase you cannot legally or practically maintain yourself. You lose the primary benefit of true open source: the ability to "fork" the code and carry on independently.
25+
2. Sharing e.g. rules for SAST scanning is not allowed or not possible.
26+
3. The test software itself is not secure and can cause security vulnerabilities.
27+
2228
:::{tip}
2329
Always consider supporting the developers or foundation behind the product. This may include contributing improvements (code or documentation) and providing financial support to help ensure the long-term sustainability and health of the FOSS project.
2430
:::

module2/toolselection.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ short_title: Tool Selection Checklist
77

88
Selecting a FOSS (Free and Open Source Software) tool for Python security testing isn't just about finding one that works—it's about ensuring the tool itself meets strict quality, maintenance, and reliability constraints.
99

10-
A Python security testing tool should meet the following criteria:
10+
A Python security testing tool should minimal meet the following criteria:
1111

12-
* **FOSS-licensed:** The product must be released under a valid FOSS licence, preferably one approved by the Open Source Initiative (OSI).
12+
* **FOSS-licensed:** The product must be released under a valid FOSS licence, preferably one approved by the [Open Source Initiative (OSI)](https://opensource.org/).
1313
* **Local-first deployment:** The tool should run locally or on a server within your own security perimeter. Avoid SaaS-only solutions where you cannot control the execution environment or data handling.
1414
* **Actively maintained:** The project should be active and demonstrate an acceptable level of quality, including regular updates and issue management.
1515
* **Public version control repository:** The source code must be publicly accessible in a version-controlled repository with a clear and verifiable URL.
1616

17-
Ideally, projects should also meet the minimum requirements outlined by the [OpenSSF Best Practices Badge](https://www.bestpractices.dev/en) Program. However, despite significant effort from the community, this programme is still not widely recognised or adopted.
17+
Ideally, projects should also meet the minimum requirements outlined by the [OpenSSF Best Practices Badge](https://www.bestpractices.dev/en) Program. However, despite significant effort from the community, this programme is not widely known and adopted.
1818

1919
In practice, you will use a long list when selecting test software for Python.
2020
For each tool, you should use a proven checklist that helps you choose a suitable FOSS testing tool for your purpose.

module3/foundation_of_sast.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ Python Static Application Security Testing (SAST) offers significant advantages
6161
| Build customer trust & confidence | Loss of reputation and user trust after breaches |
6262

6363
:::{tip}
64-
While Python is often considered a secure language, also Python applications are susceptible to common security flaws, and **SAST is a crucial, cost-effective method** to address them before deployment.
64+
While Python is often considered a secure language, also **Python applications are susceptible to common security flaws**, and **SAST is a crucial, cost-effective method** to address them before deployment.
6565
:::

module4/installation_of_tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Secure installation of test tools is not optional — it is part of the security
1616

1717
Always install security testing tools in an isolated and controlled environment:
1818

19-
* Use **virtual environments** (`venv`) for project-level isolation.
19+
* Use **virtual environments** (`venv` or use [`conda`](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)) for project-level isolation.
2020
* Prefer **dedicated test machines** or hardened virtual machines.
2121
* Never install security testing tools directly on production systems.
2222
* Ensure your operating system and Python interpreter are up to date with security patches.
@@ -121,7 +121,7 @@ This ensures:
121121

122122
## Document Installed Versions
123123

124-
Never rely on “latest” versions in professional environments. Explicitly specify versions when performing security testing that must be 100% reproducible:
124+
Never rely on “latest” versions or automatic updates in professional testing environments. Explicitly specify versions when performing security testing that must be 100% reproducible:
125125

126126
```bash
127127
pip install toolname==1.4.2

module5/sast_boundaries.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,14 @@ title: SAST Boundaries - What Can and Cannot Be Detected?
33
short_title: SAST Boundaries
44
---
55

6-
Static Application Security Testing (SAST) is one of the core techniques in Python security testing. It analyses source code without executing it, identifying patterns, data flows, and potentially dangerous constructs.
6+
**Static Application Security Testing (SAST)** is one of the core techniques in Python security testing. It analyses source code without executing it to detect **potentially dangerous constructs**.
77

8-
However, SAST is not magic.
8+
However, SAST tools for Python are not magic.
99

10-
Understanding its capabilities and limitations is critical if you are to use it effectively — or assess its results correctly during an engagement.
10+
Understanding their capabilities and limitations is critical if you are to use them effectively — or assess their results correctly during an engagement.
1111

12-
## SAST Boundaries: What Can and Cannot Be Detected?
1312

14-
Static Application Security Testing (SAST) is one of the **core techniques in Python security testing**. It analyses source code *without executing it* to detect potentially dangerous constructs.
15-
16-
However, no SAST tool for Python is not magic.
17-
18-
Understanding its **capabilities and limitations** is critical if you are to use it effectively — or assess its results correctly during an engagement.
19-
20-
21-
Each works slightly differently, but they all share a fundamental constraint:
13+
Each SAST tool works slightly differently, but they all share a fundamental constraint:
2214

2315
:::{caution}
2416
SAST can only reason about what it can *see in the code*.
@@ -235,9 +227,10 @@ SAST should be treated as:
235227
* A **triage assistant**
236228
* A **pattern detector**
237229
* A **code review accelerator**
238-
* Not a substitute for human reasoning
239230

240-
Effective workflow:
231+
**But not as a substitute for human reasoning!**
232+
233+
Effective workflow for SAST testing could be:
241234

242235
1. Run SAST early and often.
243236
2. Investigate critical sinks manually.
@@ -256,18 +249,16 @@ Effective workflow:
256249

257250

258251

252+
## Summary
259253

260-
261-
# Key Takeaways
262-
263-
SAST is powerful at detecting:
254+
SAST for Python is powerful at detecting:
264255

265256
* Known dangerous APIs
266257
* Obvious injection flows
267258
* Misconfigurations
268259
* Pattern-based weaknesses
269260

270-
SAST is weak at detecting:
261+
SAST tools are weak at detecting:
271262

272263
* Business logic flaws
273264
* Runtime-dependent vulnerabilities

0 commit comments

Comments
 (0)