Dangling references in multi-configuration and dynamic PHP-based Web applications
Abstract
PHP is a dynamic language popularly used in Web development for writing server-side code to dynamically create multiple versions of client-side pages at run time for different configurations. A PHP program contains code to be executed or produced for multiple configurations/versions. That dynamism and multi-configuration nature leads to dangling references. Specifically, in the execution for a configuration, a reference to a variable or a call to a function is dangling if its corresponding declaration cannot be found. We conducted an exploratory study to confirm the existence of such dangling reference errors including dangling cross-language and embedded references in the client-side HTML/JavaScript code and in data-accessing SQL code that are embedded in scattered PHP code. Dangling references have caused run-time fatal failures and security vulnerabilities. We developed DRC, a static analysis method to detect such dangling references. DRC uses symbolic execution to collect PHP declarations/references and to approximate all versions of the generated output, and then extracts embedded declarations/references. It associates each detected declaration/reference with a conditional constraint that represents the execution paths (i.e. configurations/versions) containing that declaration/reference. It then validates references against declarations via a novel dangling reference detection algorithm. Our empirical evaluation shows that DRC detects dangling references with high accuracy. It revealed 83 yet undiscovered defects caused by dangling references.
BibTeX
@inproceedings{Nguyen-al:ASE13,
author = {Hung Viet Nguyen and
Hoan Anh Nguyen and
Tung Thanh Nguyen and
Anh Tuan Nguyen and
Tien N. Nguyen},
title = {Dangling references in multi-configuration and dynamic {PHP-based} Web applications},
booktitle = {ASE},
pages = {399--409},
publisher = {{IEEE}},
year = {2013},
}