-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322 from Impact-I/rewrite/1.0
Rewrite/1.0
- Loading branch information
Showing
15 changed files
with
776 additions
and
808 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
|
||
jobs: | ||
build-v2: | ||
runs-on: macos-12 | ||
runs-on: macos-13 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
@@ -21,30 +21,28 @@ jobs: | |
echo "SNAPSHOT_HASH=$HASH" >> $GITHUB_ENV | ||
- name: Install tools | ||
run: | | ||
brew install ninja libusbmuxd ideviceinstaller ios-deploy [email protected] | ||
sudo rm -rf /usr/local/bin/python3 | ||
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 /usr/local/bin/python3 | ||
brew install ninja libusbmuxd ideviceinstaller ios-deploy | ||
python3 -m pip install wheel | ||
python3 -m pip install . | ||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | ||
git clone https://github.com/flutter/engine.git | ||
- name: gclient sync | ||
run: | | ||
ROOT_DIR=`pwd` | ||
export PATH=$PATH:$ROOT_DIR/depot_tools:/Library/Frameworks/Python.framework/Versions/3.11/bin | ||
export PATH=$PATH:$ROOT_DIR/depot_tools | ||
cd engine | ||
git config --global user.email "[email protected]" && git config --global user.name "reflutter" | ||
git fetch origin $(reflutter ${{env.SNAPSHOT_HASH}} -l) | ||
git fetch origin $(reflutter -b ${{env.SNAPSHOT_HASH}}) | ||
git reset --hard FETCH_HEAD | ||
reflutter ${{env.SNAPSHOT_HASH}} -l | ||
reflutter -b ${{env.SNAPSHOT_HASH}} | ||
echo 'reflutter' > REFLUTTER | ||
git add . && git commit -am "reflutter" | ||
cd $ROOT_DIR | ||
mkdir customEngine | ||
cd customEngine | ||
echo 'solutions = [{"managed": False,"name": "src/flutter","url": "'$ROOT_DIR/engine'","custom_deps": {},"deps_file": "DEPS","safesync_url": "",},]' > .gclient | ||
gclient sync | ||
reflutter ${{env.SNAPSHOT_HASH}} -l | ||
reflutter -b ${{env.SNAPSHOT_HASH}} | ||
- name: ninja build Flutter.framework | ||
run: export PATH=$PATH:`pwd`/depot_tools && sudo xcode-select -s /Applications/Xcode.app && customEngine/src/flutter/tools/gn --no-goma --ios --runtime-mode=release && ninja -C customEngine/src/out/ios_release | ||
- name: ninja build libflutter_arm64 | ||
|
@@ -70,7 +68,7 @@ jobs: | |
./*.so | ||
build-v3: | ||
runs-on: macos-12 | ||
runs-on: macos-13 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
@@ -84,30 +82,28 @@ jobs: | |
echo "SNAPSHOT_HASH=$HASH" >> $GITHUB_ENV | ||
- name: Install tools | ||
run: | | ||
brew install ninja libusbmuxd ideviceinstaller ios-deploy [email protected] | ||
sudo rm -rf /usr/local/bin/python3 | ||
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 /usr/local/bin/python3 | ||
brew install ninja libusbmuxd ideviceinstaller ios-deploy | ||
python3 -m pip install wheel | ||
python3 -m pip install . | ||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | ||
git clone https://github.com/flutter/engine.git | ||
- name: gclient sync | ||
run: | | ||
ROOT_DIR=`pwd` | ||
export PATH=$PATH:$ROOT_DIR/depot_tools:/Library/Frameworks/Python.framework/Versions/3.11/bin | ||
export PATH=$PATH:$ROOT_DIR/depot_tools | ||
cd engine | ||
git config --global user.email "[email protected]" && git config --global user.name "reflutter" | ||
git fetch origin $(reflutter ${{env.SNAPSHOT_HASH}} -l) | ||
git fetch origin $(reflutter -b ${{env.SNAPSHOT_HASH}}) | ||
git reset --hard FETCH_HEAD | ||
reflutter ${{env.SNAPSHOT_HASH}} -l patchDump | ||
reflutter -b ${{env.SNAPSHOT_HASH}} -p | ||
echo 'reflutter' > REFLUTTER | ||
git add . && git commit -am "reflutter" | ||
cd $ROOT_DIR | ||
mkdir customEngine | ||
cd customEngine | ||
echo 'solutions = [{"managed": False,"name": "src/flutter","url": "'$ROOT_DIR/engine'","custom_deps": {},"deps_file": "DEPS","safesync_url": "",},]' > .gclient | ||
gclient sync | ||
reflutter ${{env.SNAPSHOT_HASH}} -l patchDump | ||
reflutter -b ${{env.SNAPSHOT_HASH}} -p | ||
- name: ninja build Flutter.framework | ||
run: export PATH=$PATH:`pwd`/depot_tools && sudo xcode-select -s /Applications/Xcode.app && customEngine/src/flutter/tools/gn --no-goma --ios --runtime-mode=release && ninja -C customEngine/src/out/ios_release | ||
- name: ninja build libflutter_arm64 | ||
|
@@ -131,4 +127,3 @@ jobs: | |
tag_name: android-v3-${{env.SNAPSHOT_HASH}} | ||
files: | | ||
./*.so | ||
This file contains 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 |
---|---|---|
|
@@ -18,8 +18,8 @@ ENV HASH_PATCH=$HASH_PATCH | |
ENV COMMIT=$COMMIT | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND="noninteractive" apt-get install -y git git-svn git-man wget curl software-properties-common unzip python3-pip python3 lsb-release sudo apt-transport-https tzdata python3-pkgconfig && \ | ||
mkdir t | ||
DEBIAN_FRONTEND="noninteractive" apt-get install -y git git-svn git-man wget curl software-properties-common unzip python3-pip python3 lsb-release sudo apt-transport-https tzdata python3-pkgconfig && \ | ||
mkdir t | ||
|
||
ENTRYPOINT ["/bin/sh", "-c", "cd /t && pip3 install wheel && pip3 install . && rm -rf ${DEPOT_TOOLS_PATH} 2> /dev/null && git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git ${DEPOT_TOOLS_PATH} && rm -rf ${TEMP_ENGINE} 2> /dev/null && git clone https://github.com/flutter/engine.git ${TEMP_ENGINE} && rm -rf ${ENGINE_PATH} 2> /dev/null && mkdir -p ${ENGINE_PATH} && cd ${TEMP_ENGINE} && git config --global user.email \"[email protected]\" && git config --global user.name \"reflutter\" && git fetch origin ${COMMIT} && git reset --hard FETCH_HEAD && reflutter ${HASH_PATCH} -l && echo 'reflutter' > REFLUTTER && git add . && git commit -am \"reflutter\" && cd ${ENGINE_PATH} && echo 'solutions = [{\"managed\": False,\"name\": \"src/flutter\",\"url\": \"'${TEMP_ENGINE}'\",\"custom_deps\": {},\"deps_file\": \"DEPS\",\"safesync_url\": \"\",},]' > .gclient && gclient sync && reflutter ${HASH_PATCH} -l && echo \"Wait... Change the source code...\" && sleep $WAIT && if [ \"$arm64\" != \"0\" ]; then src/flutter/tools/gn --no-goma --android --android-cpu=arm64 --runtime-mode=release && ninja -C src/out/android_release_arm64 && cp src/out/android_release_arm64/lib.stripped/libflutter.so /libflutter_arm64.so ;fi && if [ \"$arm\" != \"0\" ]; then src/flutter/tools/gn --no-goma --android --android-cpu=arm --runtime-mode=release && ninja -C src/out/android_release && cp src/out/android_release/lib.stripped/libflutter.so /libflutter_arm.so ;fi && if [ \"$x64\" != \"0\" ]; then src/flutter/tools/gn --no-goma --android --android-cpu=x64 --runtime-mode=release && ninja -C src/out/android_release_x64 && cp src/out/android_release_x64/lib.stripped/libflutter.so /libflutter_x64.so; fi && cd .. && cp -va *.so /t/"] | ||
|
||
|
This file contains 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 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 |
---|---|---|
@@ -1 +1 @@ | ||
80a49c7111088100a233b2ae788e1f48 | ||
f956f595844a2f845a55707faaaa51e4 |
This file contains 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 |
---|---|---|
@@ -1,62 +1,65 @@ | ||
//frida -U -f <package> -l frida.js | ||
|
||
function hookFunc() { | ||
|
||
var dumpOffset = '0x20801C' // _kDartIsolateSnapshotInstructions + code offset | ||
|
||
var argBufferSize = 150 | ||
|
||
var address = Module.findBaseAddress('libapp.so') // libapp.so (Android) or App (IOS) | ||
console.log('\n\nbaseAddress: ' + address.toString()) | ||
|
||
var codeOffset = address.add(dumpOffset) | ||
console.log('codeOffset: ' + codeOffset.toString()) | ||
console.log('') | ||
console.log('Wait..... ') | ||
|
||
Interceptor.attach(codeOffset, { | ||
onEnter: function(args) { | ||
|
||
console.log('') | ||
console.log('--------------------------------------------|') | ||
console.log('\n Hook Function: ' + dumpOffset); | ||
console.log('') | ||
console.log('--------------------------------------------|') | ||
console.log('') | ||
|
||
for (var argStep = 0; argStep < 50; argStep++) { | ||
try { | ||
dumpArgs(argStep, args[argStep], argBufferSize); | ||
} catch (e) { | ||
|
||
break; | ||
} | ||
|
||
} | ||
|
||
}, | ||
onLeave: function(retval) { | ||
console.log('RETURN : ' + retval) | ||
dumpArgs(0, retval, 150); | ||
var dumpOffset = "0x20801C"; // _kDartIsolateSnapshotInstructions + code offset | ||
|
||
var argBufferSize = 150; | ||
|
||
var address = Module.findBaseAddress("libapp.so"); // libapp.so (Android) or App (IOS) | ||
console.log("\n\nbaseAddress: " + address.toString()); | ||
|
||
var codeOffset = address.add(dumpOffset); | ||
console.log("codeOffset: " + codeOffset.toString()); | ||
console.log(""); | ||
console.log("Wait..... "); | ||
|
||
Interceptor.attach(codeOffset, { | ||
onEnter: function (args) { | ||
console.log(""); | ||
console.log("--------------------------------------------|"); | ||
console.log("\n Hook Function: " + dumpOffset); | ||
console.log(""); | ||
console.log("--------------------------------------------|"); | ||
console.log(""); | ||
|
||
for (var argStep = 0; argStep < 50; argStep++) { | ||
try { | ||
dumpArgs(argStep, args[argStep], argBufferSize); | ||
} catch (e) { | ||
break; | ||
} | ||
}); | ||
|
||
} | ||
}, | ||
onLeave: function (retval) { | ||
console.log("RETURN : " + retval); | ||
dumpArgs(0, retval, 150); | ||
}, | ||
}); | ||
} | ||
|
||
function dumpArgs(step, address, bufSize) { | ||
|
||
var buf = Memory.readByteArray(address, bufSize) | ||
|
||
console.log('Argument ' + step + ' address ' + address.toString() + ' ' + 'buffer: ' + bufSize.toString() + '\n\n Value:\n' +hexdump(buf, { | ||
var buf = Memory.readByteArray(address, bufSize); | ||
|
||
console.log( | ||
"Argument " + | ||
step + | ||
" address " + | ||
address.toString() + | ||
" " + | ||
"buffer: " + | ||
bufSize.toString() + | ||
"\n\n Value:\n" + | ||
hexdump(buf, { | ||
offset: 0, | ||
length: bufSize, | ||
header: false, | ||
ansi: false | ||
})); | ||
ansi: false, | ||
}), | ||
); | ||
|
||
console.log('') | ||
console.log('----------------------------------------------------') | ||
console.log('') | ||
console.log(""); | ||
console.log("----------------------------------------------------"); | ||
console.log(""); | ||
} | ||
|
||
setTimeout(hookFunc, 1000) | ||
setTimeout(hookFunc, 1000); |
This file contains 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
## Useful Resources | ||
|
||
1. https://swarm.ptsecurity.com/fork-bomb-for-flutter/ | ||
2. https://medium.com/@ostorlab/flutter-reverse-engineering-and-security-analysis-41433f5671f3 | ||
1. <https://swarm.ptsecurity.com/fork-bomb-for-flutter/> | ||
2. <https://medium.com/@ostorlab/flutter-reverse-engineering-and-security-analysis-41433f5671f3> | ||
|
This file contains 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
### Helper Scripts | ||
|
||
1. `build-engine` -> Script to build custom flutter engine (macOS) | ||
2. `gen_enginehash.py` -> To dump all flutter engine and app hashes in a file. | ||
3. `get_flutter_engine.py` -> Get flutter engine hash from a Flutter engine binary. | ||
4. `get_snapshot_hash.py` -> Get app hash from `App` or `libapp.so` file. | ||
4. `get_snapshot_hash.py` -> Get app hash from `App` or `libapp.so` file. | ||
|
This file contains 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 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
Oops, something went wrong.