Dark Reading is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them.Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Application Security

Security Lessons From a New Programming Language

A security professional needed a secure language for IoT development. So he wrote his own, applying learned lessons about memory and resources in the process.

When a security researcher needs to create an application, there are many choices in terms of programming languages and frameworks. But when project requirements include SSL and an embedded Internet of Things (IoT) platform, the number of good options becomes limited. That's why Thomas Pornin decided to build his own language.

Pornin, who is technical director and member of the cryptography services practice at NCC Group, has been thinking about programming languages, their strengths, and their weaknesses for more than 30 years. He has worked on many different, complex tech deployments and has the experience of launching an open source project, BearSSL, an SSL stack that is smaller than most SSL implementations available to developers.

The language Pornin wanted to build had two significant requirements: First, its resulting applications had to fit onto a resource-constrained IoT device, and that those applications performed reasonably well. Next, the applications developed using the language would not be subject to certain built-in vulnerabilities seen in some applications. Those vulnerabilities tend to revolve around the way the processor allocates and uses memory, so Pornin focused on memory in his thinking about language security.

Getting the project started took time. "I took care to write a big specification, a 65-page document," Pornin says. "In it, I explained how it should work and why it should work that way."

From Spec to Language
The initial specification was the basis for T0, Pornin's first pass at the programming language. T0 was designed to create applications that would work on an embedded system — defined as one with severely limited memory resources, a CPU that's not very powerful, no memory management unit, and no operating system to mediate the application's interaction with the hardware.

Pornin decided to base the design of his secure IoT language on Forth — a programming language that is oriented around the idea of stacks (memory structures where the last item pushed in is the first thing pulled out). He says the decision was partially driven by practical considerations about the discipline that stacks impose on the way memory is used, and partially by aesthetics. The stack orientation means that Forth code uses a distinctive notation (Reverse Polish Notation) familiar to anyone who used an HP calculator without the "=" key.

T0 was able to create compact, operational code. Pornin simplified the job of writing the T0 compiler by having it produce C source code as its output — code that then had to be recompiled and linked into the final executable code using an existing C compiler. It was much of what he wanted, but it was not yet secure. That waited for T1.

The Next Step
In T1, which Pornin described in a presentation at NorthSec 2019, protection for memory and restrictions on stacks were introduced. While Pornin is still working on building out the details of T1 and creating the full compiler for the language, he believes the language is moving in his desired direction.

There are already a number of languages that can be used for embedded applications. Depending on the hardware in use, C, Java ME, Go, Rust Embedded, and Forth may be possibilities. So does Pornin think other security practitioners should write their own programming languages?

"I think that anybody who is really serious about development should have the idea somewhere in their head," he says. "They should think about what they would like to see in a programming language." He adds with a laugh, "And it would also be good for people at large if most would stop before actually doing it."

It is useful, though, for developers and security practitioners to understand how the compilers work and the sort of code they produce. Understanding whether they create code that makes the most of memory protection and memory structures available in the hardware can help them write more secure, more robust applications.

Related Content:

 

Black Hat USA returns to Las Vegas with hands-on technical Trainings, cutting-edge Briefings, Arsenal open-source tool demonstrations, top-tier security solutions, and service providers in the Business Hall. Click for information on the conference and to register.

 

 

 

 

Curtis Franklin Jr. is Senior Editor at Dark Reading. In this role he focuses on product and technology coverage for the publication. In addition he works on audio and video programming for Dark Reading and contributes to activities at Interop ITX, Black Hat, INsecurity, and ... View Full Bio

Comment  | 
Print  | 
More Insights
Comments
Newest First  |  Oldest First  |  Threaded View
Microsoft Patches Wormable RCE Vulns in Remote Desktop Services
Kelly Sheridan, Staff Editor, Dark Reading,  8/13/2019
The Mainframe Is Seeing a Resurgence. Is Security Keeping Pace?
Ray Overby, Co-Founder & President at Key Resources, Inc.,  8/15/2019
GitHub Named in Capital One Breach Lawsuit
Dark Reading Staff 8/14/2019
Register for Dark Reading Newsletters
White Papers
Video
Cartoon Contest
Current Issue
7 Threats & Disruptive Forces Changing the Face of Cybersecurity
This Dark Reading Tech Digest gives an in-depth look at the biggest emerging threats and disruptive forces that are changing the face of cybersecurity today.
Flash Poll
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2019-15132
PUBLISHED: 2019-08-17
Zabbix through 4.4.0alpha1 allows User Enumeration. With login requests, it is possible to enumerate application usernames based on the variability of server responses (e.g., the "Login name or password is incorrect" and "No permissions for system access" messages, or just blocki...
CVE-2019-15133
PUBLISHED: 2019-08-17
In GIFLIB before 2019-02-16, a malformed GIF file triggers a divide-by-zero exception in the decoder function DGifSlurp in dgif_lib.c if the height field of the ImageSize data structure is equal to zero.
CVE-2019-15134
PUBLISHED: 2019-08-17
RIOT through 2019.07 contains a memory leak in the TCP implementation (gnrc_tcp), allowing an attacker to consume all memory available for network packets and thus effectively stopping all network threads from working. This is related to _receive in sys/net/gnrc/transport_layer/tcp/gnrc_tcp_eventloo...
CVE-2019-14937
PUBLISHED: 2019-08-17
REDCap before 9.3.0 allows time-based SQL injection in the edit calendar event via the cal_id parameter, such as cal_id=55 and sleep(3) to Calendar/calendar_popup_ajax.php. The attacker can obtain a user's login sessionid from the database, and then re-login into REDCap to compromise all data.
CVE-2019-13069
PUBLISHED: 2019-08-17
extenua SilverSHielD 6.x fails to secure its ProgramData folder, leading to a Local Privilege Escalation to SYSTEM. The attacker must replace SilverShield.config.sqlite with a version containing an additional user account, and then use SSH and port forwarding to reach a 127.0.0.1 service.