Techniques of adding security patches to embedded systems
View Patent ↗In an aspect of the disclosure, a method, a computer-readable medium, and an apparatus are provided. The apparatus may be an embedded-system device. The embedded-system device intercepts a call to a target function in a system dynamic library. The embedded-system device invokes an intermediate function in an intercept dynamic library and corresponding to the target function. The embedded-system device refrains from calling the target function or calling the target function with one or more modified parameters.
1. A method of operating an embedded-system device, comprising:
identifying a target function;
in response to identifying the target function, generating an intercept dynamic library including an intermediate function corresponding to the target function;
intercepting a call to the target function in a system dynamic library;
loading the intercept dynamic library, wherein the target function and the intermediate function have a same function name;
assigning the intercept dynamic library an execution priority that is higher than an execution priority of the system dynamic library such that the intercept dynamic library is executed prior to an execution of the system dynamic library, wherein the assigning the intercept dynamic library the execution priority comprises adding a directive of the intercept dynamic library to a startup global environment of the embedded-system device;
invoking the intermediate function in the intercept dynamic library and corresponding to the target function; and
refraining from calling the target function or calling the target function with one or more modified parameters.
2. The method of claim 1 , further comprising:
calling a routine of the intermediate function and that substitutes the target function when refraining from calling the target function.
3. The method of claim 1 , further comprising:
obtaining at least one initial parameter used to call the target function; and
modifying one or more of the at least one initial parameter to generate the one or more modified parameters based on a predetermined rule.
4. The method of claim 1 , wherein the call to the target function is from an application of the embedded-system device.
5. An apparatus, the apparatus being an embedded-system device, comprising:
a memory; and
at least one processor coupled to the memory and configured to:
identify a target function;
in response to identifying the target function, generate an intercept dynamic library including an intermediate function corresponding to the target function;
intercept a call to the target function in a system dynamic library;
load the intercept dynamic library, wherein the target function and the intermediate function have a same function name;
assign the intercept dynamic library an execution priority that is higher than an execution priority of the system dynamic library such that the intercept dynamic library is executed prior to an execution of the system dynamic library, wherein to assign the intercept dynamic library the execution priority comprises, the at least one processor is further configured to add a directive of the intercept dynamic library to a startup global environment of the embedded-system device;
invoke the intermediate function in the intercept dynamic library and corresponding to the target function; and
refrain from calling the target function or call the target function with one or more modified parameters.
6. The apparatus of claim 5 , wherein the at least one processor is further configured to:
call a routine of the intermediate function and that substitutes the target function when refraining from calling the target function.
7. The apparatus of claim 5 , wherein the at least one processor is further configured to:
obtain at least one initial parameter used to call the target function; and
modify one or more of the at least one initial parameter to generate the one or more modified parameters based on a predetermined rule.
8. The apparatus of claim 5 , wherein the call to the target function is from an application of the embedded-system device.
9. A non-transitory computer-readable medium storing computer executable code for operating an embedded-system device, comprising code to:
identify an target function;
in response to identifying the target function, generate an intercept dynamic library including an intermediate function corresponding to the target function;
intercept a call to the target function in a system dynamic library;
load the intercept dynamic library, wherein the target function and the intermediate function have a same function name;
assign the intercept dynamic library an execution priority that is higher than an execution priority of the system dynamic library such that the intercept dynamic library is executed prior to an execution of the system dynamic library, wherein to assign the intercept dynamic library the execution priority comprises, the code is further configured to add a directive of the intercept dynamic library to a startup global environment of the embedded-system device;
invoke the intermediate function in the intercept dynamic library and corresponding to the target function; and
refrain from calling the target function or call the target function with one or more modified parameters.
10. The non-transitory computer-readable medium of claim 9 , wherein the code is further configured to:
call a routine of the intermediate function and that substitutes the target function when refraining from calling the target function.
11. The non-transitory computer-readable medium of claim 9 , wherein the code is further configured to:
obtain at least one initial parameter used to call the target function; and
modify one or more of the at least one initial parameter to generate the one or more modified parameters based on a predetermined rule.