Face authentication application security testing system based on camera data stream redirection

By embedding a camera data stream redirection module and a fake data stream generation module into the Android system, and using the Deepfake algorithm to generate fake data streams, the real-time and high technical threshold problems of face authentication APP security testing in the existing technology are solved, and imperceptible security testing in real environment is realized.

CN116863518BActive Publication Date: 2025-11-28ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310710033.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-15
Publication Date
2025-11-28
Estimated Expiration
2043-06-15

AI Technical Summary

Technical Problem

Existing security testing methods for facial recognition apps lack real-time capabilities, have high technical barriers, and are easily detected, making them ineffective against Deepfake attacks.

Method used

A security testing system for face authentication applications based on camera data stream redirection was designed. By embedding a camera data stream redirection module and a fake data stream generation module in the Android system, the system realizes real-time transmission of camera data stream and generation of fake data stream. The fake data stream generation module is deployed on the server and uses the Deepfake algorithm to generate fake data streams and replace the camera capture results.

Benefits of technology

It enables seamless security testing of face authentication applications in real-world environments, can handle proactive liveness detection, improves the real-time performance and versatility of testing, and lowers the technical barrier.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116863518B_ABST
    Figure CN116863518B_ABST
Patent Text Reader

Abstract

The application discloses a face authentication application security test system based on camera data stream redirection, comprising a camera data stream redirection module and a fake data stream generation module, the camera data stream redirection module is embedded in a camera service process, responsible for extracting and transporting the camera data stream to the fake data stream generation module, and receiving the fake data stream generated by the fake data stream generation module, instead of the original camera data stream, which is used for security test of face authentication; the fake data stream generation module is deployed on a server, generates fake data stream based on real-time camera data stream, and is transmitted to the camera data stream redirection module. The system generates fake data stream based on real-time camera data stream, and can cope with active liveness detection.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of face authentication security, and particularly relates to a face authentication application security test system based on camera data stream redirection. BACKGROUND

[0002] With the in-depth development of artificial intelligence and network technology, face authentication technology is widely used in APP-oriented identity authentication scenarios such as Internet-based financial services, government services, entertainment services, remote office, etc. However, the Deepfake technology that has emerged in recent years has greatly reduced the threshold and cost of face forgery. Ordinary people can quickly forge a face image for a specific target by using face-changing APP, not only visually confusing the real and the fake, but also deceiving face authentication related algorithms, attacking face authentication APP, and bringing great threats and challenges to the application security, data security and even property security of related systems. In the face of security problems caused by Deepfake technology, researchers urgently need related environments and methods to test the security of face authentication APP. Current research has not focused on how to provide a testing operating system environment, and the existing method is to test the APP by simulating the injection attack of black production. The principle is to replace the camera capture result with a video synthesized in advance by Deepfake algorithm or other methods into the face authentication APP for security testing by using ROM injection technology or Xposed injection framework to hijack the camera.

[0003] The ROM injection attack process is to flash a customized ROM developed in a specific model of mobile phone, record a video containing face movements and load it into the matching attack software, then enter the target APP corresponding business scene to trigger face authentication. In the customized ROM, the attacker realizes a libvirtualcamera.so module, which integrates the ffmpeg library. Through the library, the recorded video file can be decoded and converted into camera data format to replace the original camera data, and the modification of the camera context logic is realized to achieve the effect of hijacking the camera.

[0004] Xposed injection framework is a set of open source framework services running in the high permission mode of Android, which can affect the program running (modify the system) without modifying the APK file. Its working principle is to control all app processes on the mobile phone by replacing the parent process zygote process of all processes under the root permission. By modifying the ART / Davilk virtual machine, the Xposed framework can register the function that needs to be hooked as a Native layer function, replace the original function or execute before other Java functions. The attack idea of Xposed injection is to add a bypass system that is not controlled by the APP owner in the face authentication APP, and control the APP by the bypass, so that it receives the prepared face data instead of the face data captured by the camera awakened by the system. To achieve this attack method, the attacker needs to analyze the target program through technical means to find the function entry point that can be injected and called. Then install the Xposed framework on the rooted mobile phone, write your own function logic injection application, and then hijack the camera.

[0005] The existing method is to hijack the camera by ROM injection or using Xposed injection framework, and replace the camera capture result with a video synthesized in advance by Deepfake algorithm or other methods into the face authentication APP for security testing. However, these testing methods have the following shortcomings:

[0006] (1) Lack of real-time. The existing face authentication APP often has active live detection means based on real-time actions and backgrounds, and the pre-prepared video does not have these real-time features, such as making specified actions within a limited time according to random instructions, which cannot deeply test the security of the face authentication APP.

[0007] (2) High technical threshold and poor universality. Hijacking Java methods using XPosed framework requires attackers to analyze target programs through technical means to find function entry points that can be injected and called, which has a high technical threshold and is difficult to be universal.

[0008] (3) Easy to be perceived. XPosed, as a well-known Android system virtual machine injection framework, has targeted detection technology, and is easy to be regarded as a risk device when detecting application security environment. SUMMARY

[0009] In view of the above, the purpose of the present application is to provide a face authentication application security testing system based on camera data stream redirection, to test the security of face authentication applications on Android mobile phones in a real environment.

[0010] To achieve the above-mentioned purposes, the embodiment provides a face authentication application security test system based on camera data stream redirection, which comprises a camera data stream redirection module and a fake data stream generation module,

[0011] The camera data stream redirection module is embedded in a camera service process, is responsible for extracting and delivering the camera data stream to the fake data stream generation module, and receives the fake data stream generated by the fake data stream generation module, instead of the original camera data stream, which is used for security test of face authentication;

[0012] The fake data stream generation module is deployed on a server, generates a fake data stream based on real-time camera data stream, and transmits the fake data stream to the camera data stream redirection module.

[0013] Preferably, the extraction process of the camera data stream is as follows:

[0014] The camera service includes an image buffer area, and the camera3_capture_result structure is analyzed in the image buffer area, the native_handle_t structure for storing data information is extracted from the camera3_capture_result structure, the native_handle_t structure is parsed by setting log output data and combining network data to obtain key information fd_data, size and offset, wherein fd_data represents a file descriptor corresponding to an image content storage space, size and offset represent the size of the image buffer area and the offset in the memory relative to the memory domain corresponding to the file descriptor, respectively;

[0015] The memory address is calculated based on the key information fd_data, size and offset, and the image buffer area of the camera service is mapped into the current process for reading and writing to obtain image data according to the memory address, and the camera data stream is obtained by recombining the image data after analyzing the image data.

[0016] Preferably, the camera data stream redirection module comprises a data interaction unit, a first image compression / decompression unit and a first network transmission unit,

[0017] The data interaction unit is used to realize the interaction of the data stream, specifically, two shared memories mRawImage and mFakeImage are added as shared memories between different units, which are used to store the intercepted camera data stream and the fake data stream returned by the fake data stream generation module, respectively, and two interfaces setRawImage and getFakeImage are used to access the shared memories mRawImage and mFakeImage, respectively.

[0018] The first image compression / decompression unit is configured to respectively compress and decompress the camera stream data and the fake data stream;

[0019] The first network transmission unit is configured to transmit the compression result of the camera stream data to the fake data stream generation module, and to receive the fake data stream and forward it to the first image compression / decompression unit.

[0020] Preferably, the camera data stream redirection process implemented by the camera data stream redirection module comprises:

[0021] After determining that the existing camera data stream compression result in the shared memory mRawImage has been taken away, the camera data stream is extracted from the image buffer area and compressed before being stored in the shared memory mRawImage before the returnOutputBuffer function is called, waiting for network reading and transmission.

[0022] When the shared memory mFakeImage has a fake data stream, the fake data stream is read and decompressed, and the fake data stream is backfilled according to the distribution mode of the original camera data stream in the image buffer area, waiting for the upper application to call.

[0023] Preferably, the fake data stream generation module comprises a face forgery unit, a second image compression / decompression unit and a second network transmission unit,

[0024] The face forgery unit is configured to generate a fake data stream based on the camera data stream, specifically: after preprocessing the received camera data stream, the preprocessed data is processed by a Deepfake algorithm model to obtain fake data, and the fake data is post-processed to obtain a fake data stream;

[0025] The second image compression / decompression unit is configured to compress the fake data stream.

[0026] The second network transmission unit is configured to receive the camera data stream and forward it to the second image compression / decompression unit, and to transmit the compression result of the fake data stream to the camera data stream redirection module.

[0027] Preferably, the preprocessing of the received camera data stream comprises:

[0028] When the camera data stream is a JPEG byte stream, the JPEG byte stream is decompressed to obtain a pixel matrix, the pixel matrix is converted into an original image in the world coordinate axis by rotation, a face frame is extracted from the original image and face alignment is performed to obtain a transformation matrix, the original image is subjected to affine transformation according to the transformation matrix to obtain a cropped face image, and the cropped face image is subjected to size adjustment and / or color adjustment to serve as input data of the Deepfake algorithm.

[0029] Preferably, the post-processing of the forged data to obtain a forged data stream includes: after adjusting the forged data to the original size and / or color space, applying inverse transformation of the transformation matrix and fusing the adjusted image with the original background, and then obtaining the forged data stream through rotation and JPEG compression.

[0030] Preferably, when the Deepfake algorithm is used to process the pre-processed data to obtain forged data, the initialization and parameter configuration of the Deepfake algorithm model are separated from the inference function and processed once, and the pre-processing and feature extraction steps of the target image required in the model inference process only need to be completed once when the target image is imported, and only the camera data inference process needs to be reserved in the inference function.

[0031] Compared with the prior art, the present application has at least the following beneficial effects:

[0032] The designed camera data stream redirection module realizes the bidirectional real-time transmission of the data stream between the Android phone and the server through customizing the Android system, replaces the camera captured image with the Deepfake forged image in the case of no application awareness, and completes the security test of the application in the case of normal use of the face recognition application.

[0033] The designed forged data stream generation module optimizes the existing Deepfake algorithm code for real-time specific face, and provides a unified image processing method for different Deepfake algorithms, so that the existing algorithm can generate a forged data stream that retains the original background features and image format on the basis of real-time camera data stream, and has a high generation speed. BRIEF DESCRIPTION OF DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiment or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0035] Figure 1 is a structural schematic diagram of the face recognition application security test system based on camera data stream redirection provided by the embodiment;

[0036] Figure 2 is a function relationship call relationship diagram related to camera data stream return in CameraService provided by the embodiment;

[0037] Figure 3is a structure provided by the embodiment camera3_capture_result;

[0038] Figure 4 is a key information diagram provided by the embodiment;

[0039] Figure 5 is a distribution diagram of image data in memory provided by the embodiment;

[0040] Figure 6 is a data interaction unit workflow diagram provided by the embodiment;

[0041] Figure 7 is a diagram provided by the embodiment using a mixed programming method of C++ and Python;

[0042] Figure 8 is a pre-processing flowchart of camera data flow provided by the embodiment;

[0043] Figure 9 is a Deepfake image forgery flowchart provided by the embodiment. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the protection scope of the present application.

[0045] The inventive concept of the present application is that, in view of the lack of application of non-perception test environment for face authentication application security, the present application proposes a camera data flow redirection technology based on customized Android system, designs a camera image interception, transmission and backfill method in the CameraServer process, provides an Android running environment that can test the security of face authentication APP, and in view of the real-time feature of face authentication application detection and the poor real-time performance of existing Deepfake code generated forgery data flow, the present application proposes an image processing technology based on real-time camera data flow, designs a set of real-time forgery data flow generation face forgery process, which can access various Deepfake algorithm codes for testing, and solves the problem of slow forgery data flow generation speed. In combination with the above-mentioned camera data flow redirection technology, real-time fake face can be generated to meet the needs of active liveness detection of face authentication application.

[0046] Based on the above inventive concept, the face authentication application security test system based on camera data flow redirection provided by the embodiment, such as Figure 1As shown, the camera data stream redirection module and the fake data stream generation module are respectively deployed on the Android system and the server. The camera data stream redirection module is implemented in the CameraServer process of the Android camera subsystem, is responsible for extracting and delivering the camera data stream to the server, and receives the fake data stream generated by the server to replace the original camera data, and responds to the request of the upper layer to test the security of face authentication. The fake data stream generation module needs to generate a fake data stream based on real-time camera data stream. In combination with the two modules, the system realizes real-time face forgery effect, and can replace the camera capture result with the forgery result in the application without application awareness, and test the security of the face authentication application.

[0047] As shown in Figure 1 The camera data stream redirection module includes a data interaction unit, a first image compression / decompression unit and a first network transmission unit. The data interaction unit is used to realize the interaction of the data stream, and the first network transmission unit and the first image compression / decompression unit are used for network transmission. A conventional TCP connection+JPEG compression implementation idea is adopted. Specifically, the first image compression / decompression unit is used for compressing and decompressing the camera stream data and the fake data stream respectively; the first network transmission unit is used to transmit the compression result of the camera stream data to the fake data stream generation module, and is also used to receive the fake data stream and forward it to the first image compression / decompression unit.

[0048] The premise of the data stream interaction realized by the data interaction unit is to obtain the camera data stream. Extracting the original camera data storage location and format from the Android camera subsystem is the premise of intercepting, transmitting and forging the camera data stream. Most of the existing methods obtain the camera data stream in the HAL, but the latest design of Qualcomm incorporates the code related to the HAL layer into the code system of its own camera device, so the source code cannot be obtained for development. Therefore, the application traces the callback path of the camera data stream from the HAL layer to the CameraService, analyzes the key callback functions, and proposes a new camera data extraction method based on the CameraService.

[0049] The function relationship call related to the return of the camera data stream in the CameraServer process source code is as follows Figure 2CameraService with HAL layer process CameraProvider. When CameraService initializes, it will get all CameraProvider in the system and complete the two-way binding. When CameraService receives the request to open the device, it will instantiate a CameraDeviceClient object through the makeClient method. The member mDevice in the object is responsible for the callback from the HAL layer to the CameraService. When the HAL layer gets the camera data from the hardware device, it will return the capture result Capture Result to the CameraService by calling the captureResultCb function. The corresponding binding callback function is the processCaptureRequest_3_4 of Camera3Device. After multiple layers of function calls, the release of the image buffer is finally completed in the returnOutputBuffers method. Therefore, the camera data can be obtained from the image buffer before the image buffer is released by the CameraService and the image data is transferred. Because the camera data returns through the returnOutputBuffers function each time, the code added here will affect all camera data streams.

[0050] Because the CameraServer process plays a bridging function and does not itself produce or consume camera data, there is no ready-made extraction method for the image data passed into the CameraService. In the returnOutputBuffers method, the camera capture result is stored in the structure camera3_capture_result corresponding to the input parameter. By analyzing the structure, we get Figure 3 the hierarchical structure shown in the figure.

[0051] Android uses the form of a handle to facilitate the transfer of camera data between different processes, that is, the native_handle_t structure in the figure, which is used to store data information. numFds indicates the number of file descriptors followed by the data pointer, numInts indicates the size of the data followed by the data pointer. version generally indicates the size of the native_handle_t storage. Although the array size of data is 0, it actually stores image information, and the specific size is defined by numInts. Because the image is obtained through native_handle_t, which is an abnormal way of reading the camera image, the image information and format stored in data need to be explored by oneself.

[0052] The present application obtains key information by setting log output data and combining network data, such as Figure 4 As shown in the figure, fd_data and fd_metadata respectively represent file descriptors corresponding to image content and image metadata storage spaces. aligned_w and aligned_h represent the size of image data occupying in memory, and w and h represent the real size of the image. size and offset respectively represent the size of the image buffer and the offset in memory relative to the memory area corresponding to the file descriptor. According to the two information of fd_data and offset, the image buffer can be mapped to the current process for reading and writing. The final memory address Addr is calculated as follows:

[0053] Addr=mmap(0,size,0,0,fd_data,0)+offset

[0054] Reading and writing the memory area corresponding to Addr can obtain image data. It is known from network data that images are usually stored in memory in the format of NV12, but images directly read in the format of NV12 cannot be normally displayed and processed in actual operation. Through analyzing the distribution of image data, the present research found that in order to facilitate the reading and writing of image data, the image buffer is allocated a larger space according to the need of memory alignment, and the actual memory size is determined by the two variables of aligned_w and aligned_h. The distribution of image data in memory is shown in the figure. Figure 5 Each channel component is stored according to the given size, and the spare place is filled with 0. After recombination, the available camera data stream can be obtained, and the camera data stream extraction is completed.

[0055] In the embodiment, on the basis of extracting the camera data stream, the present application needs to redirect the camera data to the fake data stream generation module and receive the fake data stream to replace the original camera data stream, so the working process of the data interaction unit designed by the present application is as follows. Figure 6As shown. To enable multi-threaded communication between other units and data interaction units within the module, the Camera3Device class needs to add two member variables, mRawImage and mFakeImage, as shared memory between different units. These are used to store the captured raw camera data stream and the fake data stream returned by the fake data stream generation module, respectively. Simultaneously, two interfaces, setRawImage and getFakeImage, are implemented to access the shared memory areas mRawImage and mFakeImage. When the returnOutputBuffer function is called, it indicates that new image data has been returned from the underlying layer. Before entering the internal logic of this function, the camera data extraction method is notified to import the data into this process for data processing.

[0056] like Figure 6 As shown, the first step is to determine if the previous `mRawImage` has already been retrieved. Since the HAL layer returns data faster than the network module sends images, continuously overwriting `mRawImage` only wastes system resources and slows down response times. After confirming the previous frame has been sent, the current frame is processed. The raw camera data is then read from the image buffer mapped to the current process, and finally compressed using the jpeg-turbo library provided by the Android system. After compression, the data is filled into `mRawImage`, awaiting network transmission. Because the `returnOutputBuffer` function cannot be blocked, it cannot wait for the return of the forged data after retrieving the raw data. For the initial network connection and before the forged image is transmitted back to the Android system (i.e., `mFakeImage` is empty), this process ends directly without any modification; the upper-layer application receives the frame captured by the camera. When the first forged data stream (i.e., the forged image) returns (i.e., `mFakeImage` is not empty), the forged image is read, decompressed, and then the forged data frame is filled back according to the original view data's memory distribution. Subsequently, if the forged image for the current frame is not returned, the previous forged frame is reused to fill the gap.

[0057] In the embodiment, in order to generate a fake face in the fake data stream generation module, various advanced Deepfake related algorithms need to be deployed on the server. From the perspective of convenient deployment, easy porting and integration into mainstream development environment, the framework needs to execute Deepfake algorithm code in the Python environment. However, the pseudo-multithreading of Python causes the network module deployed by Python to be unable to execute in parallel with the face forging unit. Considering the needs of Deepfake algorithms and network communication for different language environments, the application adopts a hybrid programming method of C++ and Python, which takes advantage of the multi-threading parallelism of C++ while fully utilizing the strong support of Python environment for executing Deepfake algorithm code. The entire implementation process is as shown in Figure 7 In essence, a Python interpreter is started in the C++ program running, and the interpreter processes the Python related code, releases the resources after execution, and achieves the purpose of calling Python in the C++ program.

[0058] In order to realize hybrid programming, the header file and dynamic library of the specified Python environment need to be imported in the compilation configuration file of the C++ program, so that the Python program can be successfully started and run in the specified Python environment. Because the existing Deepfake algorithm code usually uses the conda tool to create an independent running environment, therefore, by selecting to import the Python header file and dynamic library corresponding to the virtual environment in the compilation configuration file, the called Python function can run in the configured environment. Before calling the Python function, a series of initialization operations need to be performed, such as specifying the called Python module name, function name, and converting the Python function call into a corresponding C++ function call. When calling the function, the C++ data type needs to be converted into the Python data type, which is passed into the Python environment through a specific function call, and the returned result is converted into the C++ data type.

[0059] As shown in Figure 1 The fake data stream generation module includes a face forging unit, a second image compression / decompression unit, and a second network transmission unit. The face forging unit is used to generate a fake data stream based on a camera data stream. Specifically, after preprocessing the received camera data stream, the Deepfake algorithm model is used to perform fake processing on the preprocessed data to obtain fake data, and the fake data is processed through post-processing to obtain a fake data stream. The second image compression / decompression unit is used to compress the fake data stream. The second network transmission unit is used to receive the camera data stream and forward it to the second image compression / decompression unit, and is also used to transmit the compression result of the fake data stream to the camera data stream redirection module.

[0060] In the embodiment, the face forgery unit needs to access multiple Deepfake algorithms for generating forged faces, and test the attack effects of different Deepfake algorithms on face authentication applications. At the same time, in order to meet the need of real-time generation, the existing Deepfake algorithm needs to be optimized for real-time application in the framework. For this purpose, the present application proposes an image processing technology based on real-time camera data stream, which includes pre-processing of camera data stream and real-time optimization scheme of Deepfake algorithm code. According to the analysis of different Deepfake algorithm codes, the input image of the Deepfake algorithm model is a specific size face image centered on the face and closely fitted to the face contour, while the camera data frame is a real world photo captured by the camera, and the size and face proportion of the picture depend on the application settings and the position of the photographed person. This unit needs to complete face forgery without changing the original background, so the input image required by the Deepfake algorithm needs to go through a series of image processing when it is extracted from the camera data stream. The whole processing flow is shown in Figure 8 As shown in the figure, the received camera data stream is a JPEG byte stream, which needs to be decompressed to get a pixel matrix. Because the image captured by the Android camera is imaged in the camera coordinate axis, before analyzing the face, the pixel matrix needs to be rotated to the original image in the world coordinate axis. Deepfake code often only accepts face images of specified size and angle, while this unit needs to preserve the background information in the image while obtaining the face, so first the face frame is extracted from the original image and the face is aligned by using the open source analysis tool insightface, and the transformation matrix is obtained. After that, the original image is subjected to affine transformation according to the transformation matrix to obtain the cropped face image. According to the needs of the Deepfake algorithm, the face image is subjected to size adjustment and color space conversion, and then it can be processed by the Deepfake algorithm model to obtain the forgery result. After the forgery is completed, the forged face image needs to be adjusted back to the original size and color space, and then the inverse transformation of the transformation matrix is applied and the processed image is fused with the original background, and after rotation and JPEG compression, the forged data stream can be obtained.

[0061] The face forgery unit wants to generate real-time fake data stream, and has high requirements for the forgery speed of the Deepfake algorithm. The original Deepfake forgery process is only responsible for accepting a source image and a target image, and calling a model to complete the forgery process, and does not need to consider the time problem. Therefore, the application proposes a real-time optimization scheme of the Deepfake algorithm code, which optimizes the inference time. Considering that the face forgery method required by the application does not need to replace the target image in the camera data stream forgery process, the preprocessing and feature extraction steps required for the inference process of the target image only need to be completed once when the target image is imported. The initialization and parameter configuration of the model also only need to be completed once in the whole process, and can be separated from the inference function. Only the necessary source image processing steps and model inference process are retained in the inference function, and the remaining operations are placed in the global space and executed once when the Python environment is started. The Deepfake image forgery process after real-time optimization is as shown in Figure 9 The steps in the dashed box are operations that are only performed once. This scheme optimizes the processing flow of two types of Deepfake algorithms, namely reproduction and replacement. Deepfake replacement algorithm, also known as face replacement, only needs to pass the processed camera image into the model. Deepfake reproduction algorithm, also known as face animation, is based on driving video processing of target images, and has dependence on the context of the image. In this paper, the saved previous frame camera image is used instead of the adjacent frame in the driving video in the original algorithm to calculate the motion, optical flow and other related features.

[0062] The face authentication application security test system based on camera data stream redirection provided by the above-mentioned embodiment, and through customizing the Android system, an application-level face authentication attack and defense test platform is realized, which can complete the entire test process without the application program being aware, the implementation method has innovation, and the previous research has not considered the real-time problem, and the pre-generated fake video cannot cope with the active liveness detection means of application deployment, such as making specified expressions / motions according to random instructions. The method based on real-time camera data stream generates a fake data stream, which can cope with active liveness detection. The existing ROM injection attack method also uses the technology of customizing the Android system, so it can achieve non-aware security testing of the face authentication application on the real Android mobile phone.

[0063] The face authentication application security test system based on camera data stream redirection provided by the above-mentioned embodiment can use the fake image generated by the Deepfake algorithm in real time to test the security of the face authentication application on the Android mobile phone in a real environment, perfects the test method of face authentication security at the application level, and lays a foundation for the development and perfection of the face authentication application security system.

[0064] The above detailed description of the specific embodiments of the present application has described the technical solutions and beneficial effects of the present application, and it should be understood that the above description is only the most preferred embodiment of the present application and is not intended to limit the present application. Any modifications, supplements and equivalent replacements made within the principle range of the present application shall be included in the protection range of the present application.

Claims

1. A security testing system for face authentication applications based on camera data stream redirection, characterized in that, This includes a camera data stream redirection module and a fake data stream generation module. The camera data stream redirection module is embedded in the camera service process. It is responsible for extracting and sending the camera data stream to the fake data stream generation module, and receiving the fake data stream generated by the fake data stream generation module to replace the original camera data stream. This is used for security testing of face authentication. The camera data stream extraction process is as follows: The camera3_capture_result structure in the image buffer of the camera service is analyzed. The native_handle_t structure used to store data information is extracted from the camera3_capture_result structure. The native_handle_t structure is parsed by setting log output data and combining it with online resources to obtain key information fd_data, size, and offset. Here, fd_data represents the file descriptor corresponding to the image content storage space, and size and offset represent the size of the image buffer and its offset in memory relative to the corresponding memory domain of the file descriptor, respectively. Based on the key information fd_data, size, and offset, the memory address is calculated. The image buffer of the camera service is then mapped to the current process for reading and writing to obtain image data. The image data is then analyzed and recombined to obtain the camera data stream. The camera data stream redirection module includes a data interaction unit, a first image compression / decompression unit, and a first network transmission unit. The data interaction unit is used to implement data stream interaction, specifically by adding two shared memory modules, mRawImage and mFakeImage, as different units, to store the intercepted camera data stream and the forged data stream returned by the forged data stream generation module, respectively. It also uses two interfaces, setRawImage and getFakeImage, to access the shared memory modules mRawImage and mFakeImage, respectively. The first image compression / decompression unit is used to compress and decompress the camera stream data and the forged data stream, respectively. The first network transmission unit is used to transmit the compressed result of the camera stream data to the forged data stream generation module, and also to receive the forged data stream and forward it to the first image compression / decompression unit. The fake data stream generation module is deployed on the server. It generates fake data streams based on real-time camera data streams and sends them to the camera data stream redirection module. The fake data stream generation module includes a face forgery unit, a second image compression / decompression unit, and a second network transmission unit. The face forgery unit is used to generate a fake data stream based on the camera data stream. Specifically, it preprocesses the received camera data stream, uses a Deepfake algorithm model to forge the preprocessed data to obtain fake data, and then post-processes the fake data to obtain a fake data stream. The second image compression / decompression unit is used to compress the fake data stream. The second network transmission unit is used to receive the camera data stream and forward it to the second image compression / decompression unit, and also to transmit the compression result of the fake data stream to the camera data stream redirection module.

2. The face authentication application security testing system based on camera data stream redirection according to claim 1, characterized in that, The camera data stream redirection process implemented by the camera data stream redirection module includes: After determining that the existing camera data stream compression result in the shared memory mRawImage has been taken, before the returnOutputBuffer function is called, the camera data stream is extracted from the image buffer, compressed, and stored in the shared memory mRawImage, waiting for the network to read and transmit. When there is a forged data stream in the shared memory mFakeImage cache, the forged data stream is read, decompressed, and then backfilled with the forged data stream according to the distribution of the original camera data stream in the image cache area, waiting for the upper layer application to call it.

3. The face authentication application security testing system based on camera data stream redirection according to claim 1, characterized in that, The preprocessing of the received camera data stream includes: The camera data stream is a JPEG byte stream. The JPEG byte stream is decompressed to obtain a pixel matrix. The pixel matrix is ​​rotated to transform it into the original image in world coordinates. The face bounding box is extracted from the original image and face alignment is performed to obtain a transformation matrix. The original image is subjected to an affine transformation based on the transformation matrix to obtain a cropped face image. The cropped face image is resized and / or color-adjusted and then used as input data for the Deepfake algorithm.

4. The face authentication application security testing system based on camera data stream redirection according to claim 3, characterized in that, The process of post-processing the forged data to obtain a forged data stream includes: adjusting the forged data to its original size and / or color space, applying the inverse transformation of the transformation matrix, merging the adjusted image with the original background, and then rotating and compressing it with JPEG to obtain the forged data stream.

5. The face authentication application security testing system based on camera data stream redirection according to claim 1, characterized in that, When using the Deepfake algorithm to forge data from preprocessed data, the initialization and parameter configuration of the Deepfake algorithm model are separated from the inference function and processed once. At the same time, the preprocessing and feature extraction steps of the target image required in the model inference process only need to be completed once when importing the target image. Only the inference process of camera data needs to be retained in the inference function.

Citation Information

Patent Citations

  • Head posture deviation correction-based counterfeited face change enhancement detection method

    CN113947794A

  • Utensil grabbing method for SFX microflow automatic preparation

    CN115464640A