react-native-device-defense 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -242,28 +242,6 @@ static bool checkFridaInMaps() {
|
|
|
242
242
|
* Check for SSL validation bypass in system properties
|
|
243
243
|
*/
|
|
244
244
|
static bool checkSSLValidationBypass() {
|
|
245
|
-
const std::vector<std::string> propFiles = {
|
|
246
|
-
"/system/build.prop",
|
|
247
|
-
"/vendor/build.prop",
|
|
248
|
-
"/default.prop"
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
for (const auto& propFile : propFiles) {
|
|
252
|
-
if (!fileExists(propFile)) continue;
|
|
253
|
-
|
|
254
|
-
std::ifstream file(propFile);
|
|
255
|
-
std::string line;
|
|
256
|
-
|
|
257
|
-
while (std::getline(file, line)) {
|
|
258
|
-
// Check for SSL validation bypass indicators
|
|
259
|
-
if (line.find("ssl.untrusted=0") != std::string::npos) {
|
|
260
|
-
LOGD("Found SSL validation bypass in %s", propFile.c_str());
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
245
|
return false;
|
|
268
246
|
}
|
|
269
247
|
|
|
@@ -320,27 +298,6 @@ static bool checkSSLPinningBypass() {
|
|
|
320
298
|
* Check for proxy configuration that could intercept SSL traffic
|
|
321
299
|
*/
|
|
322
300
|
static bool checkProxyConfiguration() {
|
|
323
|
-
// Check for HTTP proxy in system properties
|
|
324
|
-
const std::vector<std::string> propFiles = {
|
|
325
|
-
"/system/build.prop",
|
|
326
|
-
"/vendor/build.prop"
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
for (const auto& propFile : propFiles) {
|
|
330
|
-
if (!fileExists(propFile)) continue;
|
|
331
|
-
|
|
332
|
-
std::ifstream file(propFile);
|
|
333
|
-
std::string line;
|
|
334
|
-
|
|
335
|
-
while (std::getline(file, line)) {
|
|
336
|
-
if (line.find("http.proxy") != std::string::npos ||
|
|
337
|
-
line.find("https.proxy") != std::string::npos) {
|
|
338
|
-
LOGD("Found proxy configuration in %s", propFile.c_str());
|
|
339
|
-
return true;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
301
|
// Check for proxy environment variables
|
|
345
302
|
if (getenv("http_proxy") != nullptr || getenv("https_proxy") != nullptr) {
|
|
346
303
|
LOGD("Found proxy environment variables");
|
|
@@ -361,8 +318,14 @@ static bool checkModifiedSSLLibraries() {
|
|
|
361
318
|
const std::vector<std::string> trustedPaths = {
|
|
362
319
|
"/system/lib/libssl",
|
|
363
320
|
"/system/lib64/libssl",
|
|
364
|
-
"/
|
|
321
|
+
"/system/lib/libcrypto",
|
|
322
|
+
"/system/lib64/libcrypto",
|
|
323
|
+
"/apex/com.android.conscrypt/",
|
|
324
|
+
"/apex/com.android.runtime/",
|
|
365
325
|
"/data/app/", // App's own lib path
|
|
326
|
+
"/data/data/", // App data directory
|
|
327
|
+
"/vendor/lib/", // Vendor directory
|
|
328
|
+
"/vendor/lib64/", // Vendor directory
|
|
366
329
|
"/com.android.conscrypt"
|
|
367
330
|
};
|
|
368
331
|
|
|
@@ -396,8 +359,7 @@ static bool checkModifiedSSLLibraries() {
|
|
|
396
359
|
static bool checkCertificateTampering() {
|
|
397
360
|
// Check for user-installed CA certificates
|
|
398
361
|
const std::vector<std::string> certPaths = {
|
|
399
|
-
"/data/misc/keychain/cacerts-added"
|
|
400
|
-
"/system/etc/security/cacerts"
|
|
362
|
+
"/data/misc/keychain/cacerts-added"
|
|
401
363
|
};
|
|
402
364
|
|
|
403
365
|
for (const auto& certPath : certPaths) {
|
|
@@ -416,8 +378,8 @@ static bool checkCertificateTampering() {
|
|
|
416
378
|
closedir(dir);
|
|
417
379
|
|
|
418
380
|
// Too many user certificates might indicate tampering
|
|
419
|
-
if (certCount >
|
|
420
|
-
LOGD("Suspicious number of certificates: %d", certCount);
|
|
381
|
+
if (certCount > 10) {
|
|
382
|
+
LOGD("Suspicious number of user certificates: %d", certCount);
|
|
421
383
|
return true;
|
|
422
384
|
}
|
|
423
385
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-device-defense",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Multi-layer device security detection for React Native (root, hook, debugger, emulator detection)",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|