-
Notifications
You must be signed in to change notification settings - Fork 271
Added CVE-2016-0808 #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Added CVE-2016-0808 #113
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
.../java/fuzion24/device/vulnerability/vulnerabilities/framework/graphics/CVE_2016_0808.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package fuzion24.device.vulnerability.vulnerabilities.framework.graphics; | ||
|
||
import android.content.Context; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import fuzion24.device.vulnerability.util.CPUArch; | ||
import fuzion24.device.vulnerability.vulnerabilities.VulnerabilityTest; | ||
|
||
/** | ||
* Created by kg on 09/03/16. | ||
*/ | ||
public class CVE_2016_0808 implements VulnerabilityTest{ | ||
static { | ||
System.loadLibrary("cve-2016-0808"); | ||
} | ||
|
||
@Override | ||
public String getCVEorID() { | ||
return "CVE-2016-0808"; | ||
} | ||
|
||
@Override | ||
public boolean isVulnerable(Context context) throws Exception { | ||
int checkVal = checkCVE20160808(); | ||
if(checkVal == 0) { | ||
return false; | ||
}else if(checkVal == 1) { | ||
return true; | ||
}else { | ||
throw new Exception("Error running test"); | ||
} | ||
} | ||
|
||
@Override | ||
public List<CPUArch> getSupportedArchitectures() { | ||
ArrayList<CPUArch> archs = new ArrayList<CPUArch>(); | ||
archs.add(CPUArch.ARM7); | ||
archs.add(CPUArch.ARM); | ||
return archs; | ||
} | ||
|
||
private native int checkCVE20160808(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include <jni.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdint.h> | ||
#include <android/log.h> | ||
|
||
/* | ||
When user loads a third-party ttf font: | ||
in frameworks/minikin/CmapCoverage.cpp::getCoverageFormat12 | ||
if nGroups >= 0xfffffff0 / kGroupSize, then the ttf font will | ||
cause continuous rebooting | ||
*/ | ||
|
||
int checkIsVulnerable(){ | ||
FILE *file; | ||
long size; | ||
uint8_t *buffer; | ||
int result; | ||
|
||
|
||
file = fopen("/system/lib/libminikin.so", "rb"); | ||
|
||
if(file == NULL){ | ||
// Before 5.0, libminikin didn't exist | ||
// Hence, not vulnerable | ||
result = 0; | ||
goto done; | ||
} | ||
|
||
fseek(file, 0, SEEK_END); | ||
size = ftell(file); | ||
rewind(file); | ||
|
||
buffer = (uint8_t *)malloc(sizeof(char)*size); | ||
|
||
fread(buffer, 1, size, file); | ||
|
||
/* | ||
kGroupSize = 12 | ||
const size_t kMaxNGroups = 0xfffffff0 / kGroupSize ~ 0x15555553 (how it appears in the assembly) | ||
*/ | ||
|
||
// Check if this byte-sequence is in libminikin.so file | ||
uint8_t needle[4] = {0x53, 0x55, 0x55, 0x15}; | ||
|
||
uint8_t *p = memmem(buffer, size, needle, 4); | ||
|
||
// If the byte-sequence is present, that means the bug has been patched | ||
if(p) | ||
result = 0; | ||
else // Otherwise, there is no check for nGroups <=> vulnerable | ||
result = 1; | ||
|
||
fclose(file); | ||
free(buffer); | ||
|
||
done: | ||
return result; | ||
} | ||
|
||
JNIEXPORT jint JNICALL Java_fuzion24_device_vulnerability_vulnerabilities_framework_graphics_CVE_12016_10808_checkCVE20160808(JNIEnv *env, jobject obj){ | ||
return checkIsVulnerable(); | ||
} | ||
|
||
int main(void){ | ||
return checkIsVulnerable(); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this needle represent? some information about this, what the bug was, and how the patch works would be great.