Code obfuscation built upon code virtualization technology is one of the viable means for protecting sensitive algorithms and data against code reverse engineering attacks. Code virtualization has been successfully ap...
详细信息
Code obfuscation built upon code virtualization technology is one of the viable means for protecting sensitive algorithms and data against code reverse engineering attacks. Code virtualization has been successfully applied to programming languages like C, C++, and Java. However, it remains an outstanding challenge to apply this promising technique to javascript, a popular web programming language. This is primarily due to the open visibility of javascript code and the expensive runtime overhead associated with code virtualization. This paper presents JSPro, a novel code virtualization system for javascript. JSPro is the first javascript code obfuscation tool that builds upon the emerging WebAssembly language standard. It is designed to provide more secure code protection but without incurring a significant runtime penalty, explicitly targeting numerical javascript kernels. We achieve this by first automatically translating the target javascript code into WebAssembly and then performing code obfuscation on the compiled WebAssembly binary. Our design has two advantages over existing solutions: (1) it increases the code reverse entering complexity by implementing code obfuscation at a lower binary level and (2) it significantly reduces the performance impact of code virtualization over the native javascript code by using the performance-tuned WebAssembly language. We evaluate JSPro on a set of numerical javascript algorithms widely used in many applications. To test the performance, we apply JSPro to four mainstream web browsers running on three distinct mobile devices. Compared to state-of-the-art javascript obfuscation tools, JSPro not only provides stronger protection but also reduces the runtime overhead by at least 15% (up to 38.2%) and the code size by 28.2% on average.
Context A common practice in javascript development is to ship and deploy an application as a large file, called bundle, which is the result of combining the application code along with the code of all the libraries t...
详细信息
Context A common practice in javascript development is to ship and deploy an application as a large file, called bundle, which is the result of combining the application code along with the code of all the libraries the application depends on. Despite the benefits of having a single bundle per application, this approach leads to applications being shipped with significant portions of code that are actually not used, which unnecessarily inflates the javascript bundles and could slow down website loading because of the extra unused code. Although some static analysis techniques exist for removing unused code, our investigations suggest that there is still room for improvements. Objective: The goal of this paper is to address the problem of reducing the size of bundle files in javascript applications. Method: In this context, we define the notion of Unused Foreign Function (UFF) to denote a javascript function contained in dependent libraries that is not needed at runtime. Furthermore, we propose an approach based on dynamic analysis that assists developers to identify and remove UFFs from javascript bundles. Results: We report on a case-study performed over 22 javascript applications, showing evidence that our approach can produce size reductions of 26% on average (with reductions going up to 66% in some applications). Conclusion: It is concluded that removing unused foreign functions from javascript bundles helps reduce their size, and thus, it can boost the results of existing static analysis techniques.
Using javascript as a description language can increase the productivity of application programs on embedded systems. Since javascript is a dynamic language, it is important for a javascript virtual machine (VM) to ef...
详细信息
Using javascript as a description language can increase the productivity of application programs on embedded systems. Since javascript is a dynamic language, it is important for a javascript virtual machine (VM) to efficiently identify the types of first-class values and perform type-based dispatches. For embedded systems, the type-based dispatching code is desired to be compact as well as fast. Although operators of javascript are heavily overloaded and capable of accepting a variety of datatypes as operands, all the datatypes are not always necessarily used in a specific program. If some datatypes are never used in this program, a VM for a subset of javascript with operators that support limited datatypes suffices. Such a VM is expected to be compact and efficient. In addition, internal representation of datatype of each value may affect performance of type-based dispatching. This paper presents a novel framework that can generate a VM for a subset of javascript on the basis of operand specifications and datatype specifications given by the programmer. The operand specifications describe possible operand datatypes for every instruction and the datatype specifications describe adequate internal representations of necessary datatypes for a target program. The generated VM is specialized in the sense that it has efficient and minimum type-based dispatching code for all instructions.
javascript is a powerful scripting programming language that has gained a lot of attention this past decade. Initially used exclusively for client-side web development, it has evolved to become one of the most popular...
详细信息
javascript is a powerful scripting programming language that has gained a lot of attention this past decade. Initially used exclusively for client-side web development, it has evolved to become one of the most popular programming languages, with developers now using it for both client-side and server-side application development. Similar to applications written in other programming languages, javascript applications contain code smells, which are poor design choices that can negatively impact the quality of an application. In this paper, we perform a large-scale study of javascript code smells in server-side and client-side applications, with the aim to understand how they impact the fault-proneness of applications, and how they are evolved by the developers of the applications. We detect 12 types of code smells in 1807 releases of 15 popular javascript applications (i.e., express, grunt, bower, ***, request, jquery, vue, ramda, leaflet, hexo, chart, webpack, webtorrent, moment, and riot) and perform survival analysis, comparing the time until a fault occurrence, in files containing code smells and files without code smells. We also examine the introduction and removal of the code smells in the applications using survival models. All our analysis are conducted at the granularity of the line of code. Results show that (1) on average, files without code smells have hazard rates at least 33% lower than files with code smells. (2) Among the studied smells, "Variable Re-assign," "Assignment In Conditional statements," and "Complex Code" smells have the highest fault hazard rates. (3) Code smells, and particularly "Variable Re-assign," are often introduced in the application when the files containing them are created. Moreover, they tend to remain in the applications for a long period of time;"Variable Re-assign" is also the most prevalent code smell. Overall, code smells affect negatively the quality of javascript applications and developers should consider tracking
While javascript programs have become pervasive in web applications, they remain hard to reason about. In this context, most static analyses for javascript programs require precise call graph information, since the pr...
详细信息
While javascript programs have become pervasive in web applications, they remain hard to reason about. In this context, most static analyses for javascript programs require precise call graph information, since the presence of large numbers of spurious callees significantly deteriorates precision. One of the most challenging javascript features that complicate the inference of precise static call graph information is read/write accesses to object fields, the names of which are computed at runtime. javascript framework libraries often exploit this facility to build objects from other objects, as a way to simulate sophisticated high-level programming constructions. Such code patterns are difficult to analyze precisely, due to weak updates and limitations of unrolling techniques. In this paper, we observe that precise field origination relations can be inferred by locally reasoning about object copies, both regarding to the object and to the program structure, and we propose an abstraction that allows to separately reason about field read/write access patterns working on different fields and to carefully handle the sets of javascript object fields. We formalize and implement an analysis based on this technique. We evaluate the performance and precision of the analysis on the computation of call graph information for examples from jQuery tutorials.
暂无评论