GantMan / GantMan/jail-monkey

Problem with message collection in `jailBrokenMessage` on iOS

Open Beginner friendly
#362 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
757
Forks
166
PR merge metrics
No merged PRs in 30d

Description

There are two issues with message collection in `jailBrokenMessage` on iOS:

1. `checkDylibsMessage` overwrites the message with `imagePath`.
```objc
- (NSString *)checkDylibsMessage
{
NSString *imagePath;

for (int i=0; i < _dyld_image_count(); i++) {
imagePath = [NSString stringWithUTF8String:_dyld_get_image_name(i)]; <-- Here

for (NSString *dylibPath in [self dylibsToCheck]) {
if([imagePath localizedCaseInsensitiveContainsString:dylibPath]) {
imagePath = [NSString stringWithFormat:@"%@,%@", imagePath, dylibPath];
}
}
}
return imagePath;
}
```

It's needed to separate `imagePath` and `dylibsMessage`:
```objc
- (NSString *)checkDylibsMessage
{
NSString *dylibsMessage = @"";
NSString *imagePath;

for (int i=0; i < _dyld_image_count(); i++) {
imagePath = [NSString stringWithUTF8String:_dyld_get_image_name(i)];

for (NSString *dylibPath in [self dylibsToCheck]) {
if([imagePath localizedCaseInsensitiveContainsString:dylibPath]) {
dylibsMessage = [NSString stringWithFormat:@"%@,%@", dylibsMessage, dylibPath];
}
}
}
return dylibsMessage;
}
```

2. `checkPathsMessage` and `checkSchemesMessage` logs only the first path found, since the cycle is terminated:
```objc
- (NSString *)checkSchemesMessage
{
NSString *schemeMessage = @"";
for (NSString *scheme in [self schemesToCheck]) {
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]){
schemeMessage = [NSString stringWithFormat:@"%@,%@", schemeMessage, scheme];
break; <-- Here
}
}
return schemeMessage;
}

- (NSString *)checkPathsMessage
{
NSString *existsPath = @"";
for (NSString *path in [self pathsToCheck]) {
if ([[NSFileManager defaultManager] fileExistsAtPath:path]){
existsPath = [NSString stringWithFormat:@"%@,%@", existsPath, path];
break; <-- Here
}
}
return existsPath;
}
```

It's needed to log all found files and schemes:
```objc
- (NSString *)checkSchemesMessage
{
NSString *schemeMessage = @"";
for (NSString *scheme in [self schemesToCheck]) {
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]){
schemeMessage = [NSString stringWithFormat:@"%@,%@", schemeMessage, scheme];
}
}
return schemeMessage;
}

- (NSString *)checkPathsMessage
{
NSString *existsPath = @"";
for (NSString *path in [self pathsToCheck]) {
if ([[NSFileManager defaultManager] fileExistsAtPath:path]){
existsPath = [NSString stringWithFormat:@"%@,%@", existsPath, path];
}
}
return existsPath;
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the iOS implementation of jailBrokenMessage and its checkDylibsMessage, checkPathsMessage, and checkSchemesMessage methods. Verify that each method preserves all matching dylibs, paths, or schemes, then confirm the returned messages include every match rather than only the last or first one.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c, react-native
Domain
mobile-dev, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.