GrammaTalk

GrammaTech Releases Open-Source API Usage Error Detection Tool

Posted on

by

SWAP Detector Uses “Big Code Analysis” Techniques to Catalog Known Good Call Patterns and Identify Anomalies Associated with API-Usage Bugs

swap-grammatech

August 26, 2020

BETHESDA, MD

GrammaTech, a leading provider of software application security testing solutions, today announced it has released Swap Detector, an open-source checker that detects Application programming interface (API) usage errors. The tool, developed as part of a research project sponsored by the Department of Homeland Security (DHS) Science and Technology Directorate (S&T) Static Tool Analysis Modernization Project (STAMP), improves application security testing for DevOps.

Modern software development involves the use of third-party APIs, libraries, and/or frameworks that are complex, rapidly evolving, and sometimes poorly documented. According to industry estimates, open source components can represent up to 90% of the code in the average application. Meanwhile, API usage errors are a common source of security and reliability vulnerabilities. SWAP Detector enables developers and DevOps teams to identify errors due to swapped function arguments, which can also be present in deployed code.

“Traditional static-analysis techniques do not take advantage of the vast wealth of information on what represents error-free coding practices available in the open-source domain,” says Alexey Loginov, Vice President of Research at GrammaTech. “With SWAP Detector we applied Big Data analysis techniques, what we call Big Code analysis, to the Fedora RPM open-source repository to baseline correct API usage. This allowed us to develop error-detection capabilities that far exceed the scalability and accuracy of conventional approaches to program analysis.”

SWAP Detector consumes input information about a call site, and optionally, function declaration information pertaining to that call site. If it detects a potential swapped-argument error at that call site, it outputs an appropriate warning message and a score for the warning. Its interface integrates with a variety of static analysis tools, such as Clang Static Analyzer, Clang-Tidy, and PyLint. Although initially focused on C/C++ programs, SWAP Detector is applicable to programs in other languages; and is especially beneficial for languages that are interpreted and not compiled.

SWAP Detector uses multiple error-detection techniques, layered together to increase accuracy. For example, it compares argument names used in call sites with the parameter names used in corresponding declarations. In addition, it uses “Big Code” techniques, applying statistical information about usages of “known good” API-usage patterns collected from a large corpus of code, and flagging usages that are statistically anomalous as potential errors. To improve the precision of the reported warnings, SWAP Detector applies false-positive reduction strategies to the output of both techniques. 

SWAP Detector was developed based on research sponsored by DHS S&T (contract numbers HHSP233201600062C, 70RSAT19C00000056). The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of DHS.


To view more GrammaTech Research, check out our Sponsored Research Projects.


About GrammaTech

GrammaTech is a leading global provider of software analysis and testing solutions used by the world’s most security conscious organizations to detect, measure, analyze and resolve security and safety vulnerabilities. The company is also a trusted cybersecurity research partner for the nation’s civil, defense, and intelligence communities. GrammaTech has corporate headquarters in Bethesda MD with a Research and Development Center in Ithaca NY. Visit us at https://www.grammatech.com/, and follow us on LinkedIn and Twitter.

CodeSonar® and Julia Engine are registered trademarks of GrammaTech, Inc.

Related Posts

Check out all of GrammaTech’s resources and stay informed.

view all posts

Contact Us

Get a personally guided tour of our solution offerings. 

Contact US