You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pay attention to the capitalization of letters about assets and Assets
When the assets directory contains the Assets folder, an additional folder named Assets will be generated at the same level as assets in the generated apk. All non-directory files under the original assets will be placed in the Assets directory.
error code
brut.util.BrutIO#sanitizeFilepath:
final String canonicalEntryPath = new File(directory, entry).getCanonicalPath();
public static String sanitizeFilepath(final File directory, final String entry) throws IOException, BrutException {
if (entry.isEmpty()) {
throw new InvalidUnknownFileException("Invalid Unknown File");
}
if (new File(entry).isAbsolute()) {
throw new RootUnknownFileException("Absolute Unknown Files is not allowed");
}
final String canonicalDirPath = directory.getCanonicalPath() + File.separator;
final String canonicalEntryPath = new File(directory, entry).getCanonicalPath();
if (!canonicalEntryPath.startsWith(canonicalDirPath)) {
throw new TraversalUnknownFileException("Directory Traversal is not allowed");
}
// https://stackoverflow.com/q/2375903/455008
return canonicalEntryPath.substring(canonicalDirPath.length());
}
my temporary solution
Looking forward to the perfect solution.
public static String sanitizeFilepath(final File directory, final String entry) throws IOException, BrutException {
if (entry.isEmpty()) {
throw new InvalidUnknownFileException("Invalid Unknown File");
}
if (new File(entry).isAbsolute()) {
throw new RootUnknownFileException("Absolute Unknown Files is not allowed");
}
final String canonicalDirPath = directory.getCanonicalPath() + File.separator;
final File file = new File(directory, entry);
String canonicalEntryPath = file.getCanonicalPath();
if (canonicalEntryPath.contains("/assets/Assets/")) {
final String absolutePath = file.getAbsolutePath();
if (!canonicalEntryPath.equals(absolutePath)) {
LOGGER.info("sanitizeFilepath: replace path, from = " + canonicalEntryPath + " , to = " + absolutePath);
canonicalEntryPath = absolutePath;
}
}
if (!canonicalEntryPath.startsWith(canonicalDirPath)) {
throw new TraversalUnknownFileException("Directory Traversal is not allowed");
}
// https://stackoverflow.com/q/2375903/455008
return canonicalEntryPath.substring(canonicalDirPath.length());
}
The text was updated successfully, but these errors were encountered:
Information
apktool -version
) - 2.9.3java --version
) - java 11Bug
Pay attention to the capitalization of letters about assets and Assets
When the assets directory contains the Assets folder, an additional folder named Assets will be generated at the same level as assets in the generated apk. All non-directory files under the original assets will be placed in the Assets directory.
error code
brut.util.BrutIO#sanitizeFilepath:
final String canonicalEntryPath = new File(directory, entry).getCanonicalPath();
my temporary solution
Looking forward to the perfect solution.
The text was updated successfully, but these errors were encountered: