Static analysis of wolfSSL with SonarCloud, and what the findings meant
Academic project · 2025
A coursework scan of the open-source wolfSSL TLS library with SonarCloud, and a reading of its results that separates test material from real risk.
In short
- What it is
- A static analysis (SAST) of wolfSSL, an open-source TLS library for embedded systems written in C, with SonarCloud, followed by a short report that interprets the results.
- Why
- To see what a lightweight static analyser finds in security-critical embedded C code, and how much of it needs a human to judge.
- My role
- Coursework for the "Securing Embedded Software" course at ESILV.
- Domains and tech
- DevSecOps. SonarCloud, static application security testing, C.
- Status
- Academic project. Scan run and report written in December 2025. Many of the flagged "vulnerabilities" turned out to be test and example material. Code coverage could not be obtained.
- Period
- Dec 2025
Context and problem
The exercise was to run a lightweight static analysis tool on an embedded software project and judge what it says about code quality and security. I chose wolfSSL, an open-source TLS library written in C for constrained devices (RTOS, IoT), because memory safety and correct cryptography both matter in it.
Report, p.1–2 (21 December 2025)What the scanner reported
SonarCloud analysed over 2 million lines. These are the scanner’s own figures, not confirmed flaws:
| Measure | Scanner output |
|---|---|
| Reliability | rating E, 288 open bugs |
| Security | rating E, 135 open vulnerabilities |
| Maintainability | rating A, about 15,000 code smells |
| Duplication | 38.1 % |
| Security hotspots | 171 |
Reading the results
Two groups stood out:
strcpycalls. 145 instances were flagged with “Make sure use of ‘strcpy’ is safe here”.strcpydoesn’t check the size of its destination, which is a classic overflow risk in embedded C. Whether each call is safe depends on what reaches it, which the scanner can’t know, so each one needs a manual check or a bounded replacement.- Keys and passwords. The scanner’s highest-severity findings were private keys and a password in the code. Their locations — the library’s test and certificate directories — show they are fixtures for unit tests and examples, not keys shipped in the library. They still carry a risk if someone copies example code into a device.
So the E security rating doesn’t mean the library is insecure: the scanner finds patterns, and context decides which ones matter. The tool is useful to catch these patterns early, but its output needs a person who knows how the code is used.
Limitations
- No coverage. For C, SonarCloud needs a build wrapper to capture compilation, a coverage tool such as
gcovorllvm-cov, and a conversion step. Setting that up in the CI environment proved complex, and the coverage metric stayed empty. - The review was not exhaustive. The report argues from example files; it doesn’t count how many of the 135 findings are test material, and it doesn’t classify the remaining hotspots.
- Not reproducible as written. The report doesn’t record the wolfSSL version scanned or how the scan was configured.
- No finding was fixed or reported upstream: the work stops at analysis.