OWASP Embedded Application Security

= Main =  {| style="padding: 0;margin:0;margin-top:10px;text-align:left;" |-
 * valign="top" style="border-right: 1px dotted gray;padding-right:25px;" |

OWASP Embedded Application Security Project
Each year, the number of enterprise and consumer devices with embedded software are on the rise. Given the publicity with IoT and more devices becoming network connected, it is essential to create secure coding guidelines for embedded software. Embedded Application Security is not often a high priority for embedded devices such as Routers, Managed Switches, IoT devices, and even ATM Kiosks. There are many challenges in the embedded field including ODM supply chain, limited memory, a small stack, and the challenge of pushing firmware updates securely to an endpoint. The goal of this project is to create a list of best practices, provide practical guidance to embedded developers, and to draw on the resources that OWASP already has to bring application security expertise to the embedded world.


 * valign="top" style="padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;" |

Mailing List
Embedded Sec Mailing List

Project Leaders
Aaron Guzman [mailto:aaron.guzman@owasp.org @] Alex Lafrenz [mailto:alex.lafrenz@owasp.org @]

Related Projects

 * OWASP Internet of Things Project
 * C-Based Toolchain Hardening
 * OWASP Mobile Security Project


 * valign="top" style="padding-left:25px;width:200px;" |

News and Events

 * [18 July 2016] New Project Template

In Print
We will be releasing a user guide soon!

Classifications

 * }

= Embedded Best Practices =

The Working Document can be found here (Google Docs)-

find. -type f -name '*.c' -print0|xargs -0 grep -e 'strncpy.*strlen'|wc -l strncat( buffer, SOME_DATA, strlen( SOME_DATA )); /* WRONG */ char buffer[SOME_SIZE]; strncat( buffer, SOME_DATA, sizeof(buffer)); /* RIGHT */ Example:The following command injection code is based upon wrapping the UNIX command cat which prints the contents of a file to standard output.:
 * 1) Buffer and Stack Overflow Protection - Prevent the use of dangerous functions and APIs in efforts to protect against memory-corruption vulnerabilities inside firmware. (e.g. Use of unsafe C functions - strcat, strcpy, sprintf, scanf)
 * 2) Buffer Considerations
 * 3) What kind of buffer and where it resides: physical, logical, virtual memory
 * 4) What data will remain when the buffer is freed or left around to LRU out
 * 5) What strategy will be followed to insure old buffer do not leak data (example: clear buffer after use)
 * 6) Initialize buffers to known value on allocation
 * 7) Consider where variables are stored: stack, static or allocated structure
 * 8) Explicitly initialize variables
 * 9) Ensure secure compiler flags or switches are utilized upon each firmware build. (e.g. For GCC -fPIE, -fstack-protector-all, -Wl,-z,noexecstack, -Wl,-z,noexecheap etc..)
 * 10) Find Vulnerable C functions in source. Example
 * 1) Ensure all untrusted data and user input is validated, sanitized, and output encoded to prevent from unintended system execution.


 * 1) include 
 * 2) include 

int main(int argc, char **argv) { char cat[] = "cat "; char *command; size_t commandLength;

commandLength = strlen(cat) + strlen(argv[1]) + 1; command = (char *) malloc(commandLength); strncpy(command, cat, commandLength); strncat(command, argv[1], (commandLength - strlen(cat)) );

system(command); return (0); }
 * 1) Ensure robust update mechanisms utilize cryptographically signed firmware images for updating functions.
 * 2) Do not hard code secrets such as passwords, usernames, tokens, private keys or similar variants into firmware images.
 * 3) Dispose and securely wipe sensitive information stored in buffers or temporary files during runtime after they are no longer needed (e.g. Wipe buffers from locations where personal identifiable information is stored before releasing the buffers)
 * 4) Modify Busybox and embedded frameworks alike to only libraries and functions that are being used. (e.g.. Remove unused languages like perl and services such as Telnet, FTP etc)
 * 5) Validate all debugging and pre-production code have been removed prior to firmware deployment.This includes potential "backdoors code" and accounts left behind by ODM's code base.
 * 6) Ensure all methods of communication are utilizing industry standard encryption configurations for TLS.
 * 7) Limit collection, storage, and sharing of personal identifiable information (PII) to items that are only required for operation.
 * 8) Ensure the kernel, software packages and third party libraries utilized in embedded images are updated to prevent from known publicly available exploits. (e.g. Rompager  UPnP

This list was created based upon community feedback discussed here

= Table of Contents =

Draft-The items below are subject to change

Get Involved
= Embedded Device Firmware Analysis Tools =


 * Angr -
 * Firmadyne
 * Firmwalker
 * Binary Analysis
 * Flaw Finder
 * IDA Pro (supports ARM / MIPS)
 * Radare2
 * GDB
 * Binwalk
 * Firmware-mod-toolkit
 * Capstone framework
 * Shikra
 * JTagulator
 * UART cables
 * JTAG Adapters (JLINK)
 * BusPirate
 * BusBlaster
 * CPLDs (in lieu of FPGAs)
 * Oscilloscopes
 * Multimeter (Ammeter, Voltmeter, etc)
 * Logic Analyzers for SPI
 * OpenOCD
 * GreatFET

= Roadmap =

2016-2017 Roadmap

 * Curate a list of embedded secure coding best practices.
 * Create a Top 10 Embedded Application Security list.
 * Participate in PR-related activities to involve the embedded community at large.

Feel free to join the mailing list and contact the Project leader if you feel you can contribute.