【Android 逆向】【攻防世界】ill-intentions
1. apk 安装到手机, 啥输入框都没有
2. apk拖入到jadx中看看
public class MainActivity extends Activity {
@Override // android.app.Activity
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(getApplicationContext());
tv.setText("Select the activity you wish to interact with.To-Do: Add buttons to select activity, for now use Send_to_Activity");
setContentView(tv);
IntentFilter filter = new IntentFilter();
filter.addAction("com.ctf.INCOMING_INTENT");
Send_to_Activity receiver = new Send_to_Activity();
registerReceiver(receiver, filter, Manifest.permission._MSG, null);
}
}
大概就是动态注册了一个广播接收器,看看接收器代码
/* loaded from: classes.dex */
public class Send_to_Activity extends BroadcastReceiver {
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
String msgText = intent.getStringExtra("msg");
if (msgText.equalsIgnoreCase("ThisIsTheRealOne")) {
Intent outIntent = new Intent(context, ThisIsTheRealOne.class);
context.startActivity(outIntent);
} else if (msgText.equalsIgnoreCase("IsThisTheRealOne")) {
Intent outIntent2 = new Intent(context, IsThisTheRealOne.class);
context.startActivity(outIntent2);
} else if (msgText.equalsIgnoreCase("DefinitelyNotThisOne")) {
Intent outIntent3 = new Intent(context, DefinitelyNotThisOne.class);
context.startActivity(outIntent3);
} else {
Toast.makeText(context, "Which Activity do you wish to interact with?", 1).show();
}
}
}
广播接收就跳转到各个activity,直接使用objecttion来实现直接跳到对应的activity
└─# objection -g com.example.hellojni explore
A newer version of objection is available!
You have v1.9.6 and v1.11.0 is ready for download.
Upgrade with: pip3 install objection --upgrade
For more information, please see: https://github.com/sensepost/objection/wiki/Updating
Using USB device `MI 5X`
Agent injected and responds ok!
_ _ _ _
___| |_|_|___ ___| |_|_|___ ___
| . | . | | -_| _| _| | . | |
|___|___| |___|___|_| |_|___|_|_|
|___|(object)inject(ion) v1.9.6
Runtime Mobile Exploration
by: @leonjza from @sensepost
[tab] for command suggestions
com.example.hellojni on (xiaomi: 8.1.0) [usb] # android intent launch_activity com.example.application.Def
initelyNotThisOne
(agent) Starting activity com.example.application.DefinitelyNotThisOne...
(agent) Activity successfully asked to start.
com.example.hellojni on (xiaomi: 8.1.0) [usb] # android intent launch_activity com.example.application.IsT
hisTheRealOne
(agent) Starting activity com.example.application.IsThisTheRealOne...
(agent) Activity successfully asked to start.
com.example.hellojni on (xiaomi: 8.1.0) [usb] #
每个activity 都使用了一个native函数, hook住它,看看有没有什么发现
3. 编写脚本
function main() {
Java.perform(function() {
var DefinitelyNotThisOneHandler = Java.use('com.example.application.DefinitelyNotThisOne')
DefinitelyNotThisOneHandler.definitelyNotThis.implementation = function(arg0, arg1) {
console.log('DefinitelyNotThisOneHandler called: ' + arg0 + " \n" + arg1)
var ret = this.definitelyNotThis(arg0, arg1)
console.log('DefinitelyNotThisOneHandler ret: ' + ret )
return ret
}
var ThisIsTheRealOneHandler = Java.use('com.example.application.ThisIsTheRealOne')
ThisIsTheRealOneHandler.orThat.overload('java.lang.String', 'java.lang.String', 'java.lang.String').implementation = function(arg0, arg1, arg2) {
console.log('ThisIsTheRealOneHandler called: ' + arg0 + " \n" + arg1 + " \n" + arg2)
var ret = this.orThat(arg0, arg1, arg2)
console.log('ThisIsTheRealOneHandler ret: ' + ret )
return ret
}
var IsThisTheRealOneHandler = Java.use('com.example.application.IsThisTheRealOne')
IsThisTheRealOneHandler.perhapsThis.overload('java.lang.String', 'java.lang.String', 'java.lang.String').implementation = function(arg0, arg1, arg2) {
console.log('IsThisTheRealOneHandler called: ' + arg0 + " \n" + arg1 + " \n" + arg2)
var ret = this.perhapsThis(arg0, arg1, arg2)
console.log('IsThisTheRealOneHandler ret: ' + ret )
return ret
}
})
}
setImmediate(main)
日志
(hooker_3.8.5) ┌──(hooker_3.8.5)(root㉿r0env)-[~/Documents/code_dir/study/20230215/001]
└─# frida -U com.example.hellojni -l lesson16.js --no-pause
____
/ _ | Frida 14.2.2 - A world-class dynamic instrumentation toolkit
| (_| |
> _ | Commands:
/_/ |_| help -> Displays the help system
. . . . object? -> Display information about 'object'
. . . . exit/quit -> Exit
. . . .
. . . . More info at https://www.frida.re/docs/home/
[MI 5X::com.example.hellojni]-> DefinitelyNotThisOneHandler called: YjYwYWZjMjRkMhVhZTQhZDIwZGFkNWJhMGZmZGYiYmQaMmFkMjBiMTEhNDAtMzMzMjdlZmEWNzU?
MzYwNjMeNjgxNWZkNGQeOTFhOTIhNDkiMDVhNDBkYTAyNWQtYhYxNWYwOTUxMzZiMTlmMzciMjM?
DefinitelyNotThisOneHandler ret: Told you so!
[MI 5X::com.example.hellojni]->
[MI 5X::com.example.hellojni]->
[MI 5X::com.example.hellojni]->
[MI 5X::com.example.hellojni]-> IsThisTheRealOneHandler called: TRytfrgooq|F{i-JovFBungFk\VlphgQbwvj~HuDgaeTzuSt.@Lex^~
ZGFkNGIwYzIWYjEzMTUWNjVjNTVlNjZhOGJkNhYtODIyOGEaMTMWNmQaOTVjZjkhMzRjYmUzZGE?
MzQxZTZmZjAxMmIiMWUzNjUxMmRiYjIxNDUwYTUxMWItZGQzNWUtMzkyOWYyMmQeYjZmMzEaNDQ?
IsThisTheRealOneHandler ret: Congratulation!YouFoundTheRightActivityHereYouGo-CTF{IDontHaveABadjokeSorry}
日志中(返回值)发现flag
【Android 逆向】【攻防世界】ill-intentions的更多相关文章
- 逆向-攻防世界-crackme
查壳,nSpack壳,直接用软件脱壳,IDA载入程序. 很明显,就是将402130的数据和输入的数据进行异或,判断是否等于402150处的数据.dwrd占4字节. 这道题主要记录一下刚学到的,直接在I ...
- 逆向-攻防世界-maze
题目提示是走迷宫. IDA载入程序分析. 输入字符长度必须是24,开头必须是nctf{,结尾必须是}.在125处按R就可以变成字符. sub_400650和sub_400660是关键函数,分析sub_ ...
- 逆向-攻防世界-CSAW2013Reversing2
运行程序乱码,OD载入搜索字符串,断电到弹窗Flag附近. 发现跳过00B61000函数,弹窗乱码,我们试试调用00B61000函数.将00B61094的指令修改为JE SHORT 00B6109b. ...
- 逆向-攻防世界-logmein
iDA载入程序,shift+F12查看关键字符串,找到双击来到所在地址,进入函数 然后进入主函数, 经过分析,可以得出:输入的字符要等于 经过处理的v7和v8的异或.v8很明显,但是v7是怎么回事呢 ...
- 逆向-攻防世界-no-strings-attached
看题目就知道查找不到关键字符串,为防止踩坑,strings命令查看,没有找到有用的字符串.IDA载入程序查找入口函数, main函数中有4个函数,经过分析判断authenticate()为关键函数,跟 ...
- 攻防世界逆向——game
攻防世界逆向:game wp 攻防世界逆向新手区的一道题目. 是一道windows的creak,动态调试打开是这样的: 题目说明是让屏幕上所有的图像都亮之后,会出现flag,看来应该是可以玩出来的. ...
- [转]Android逆向之动态调试总结
一.在SO中关键函数上下断点 刚学逆向调试时.大多都满足于在SO中某关键函数上下断点.然后通过操作应用程序,去触发这个断点,然后进行调试 详细的步骤可以参见非虫大大的<Android软件安全与逆 ...
- 攻防世界 reverse evil
这是2017 ddctf的一道逆向题, 挑战:<恶意软件分析> 赛题背景: 员工小A收到了一封邮件,带一个文档附件,小A随手打开了附件.随后IT部门发现小A的电脑发出了异常网络访问请求,进 ...
- 攻防世界 reverse 进阶 APK-逆向2
APK-逆向2 Hack-you-2014 (看名以为是安卓逆向呢0.0,搞错了吧) 程序是.net写的,直接祭出神器dnSpy 1 using System; 2 using System.Diag ...
- Android trap攻防思路整理
Android trap攻防 图/文 h_one 0x01 反 ...
随机推荐
- [转帖]TiDB损坏多副本之有损恢复处理方法
https://tidb.net/blog/b1ae4ee7 TiDB分布式数据库采用多副本机制,数据副本通过 Multi-Raft 协议同步事务日志,确保数据强一致性且少数副本发生故障时不影响数 ...
- [转帖]《Linux性能优化实战》笔记(四)—— CPU 使用率
一. 节拍率与CPU时间 前一篇说到,Linux 作为一个多任务操作系统,将每个 CPU 的时间划分为很短的时间片,再通过调度器轮流分配给各个任务使用,因此造成多任务同时运行的错觉. 为了维护 CPU ...
- Spring 应用合并之路(一):摸石头过河 | 京东云技术团队
公司在推进降本增效,在尝多种手段之后,发现应用太多,每个应用都做跨机房容灾部署,则最少需要 4 台机器(称为容器更合适).那么,将相近应用做一个合并,减少维护项目,提高机器利用率就是一个可选方案. 经 ...
- 离线下载和安装UWP(windows应用商店)软件
离线下载uwp安装包 打开商店,然后搜索您要的应用程序名称,进入应用界面 点击 分享按钮,在弹出窗口中选择[复制链接] 把链接粘贴到:https://store.rg-adguard.net/ 默认选 ...
- 【SpringBoot】当AOP引发的异常与@RestControllerAdvice擦肩而过:异常处理的盲点揭秘
各位上午/下午/晚上好呀! 今天在写bug的时候发现一个这样的问题: AOP抛出的异常竟然没有被@RestControllerAdvice注解修饰的异常统一处理类处理. 有一个需求,对某些加了自定义注 ...
- 爆了!Sealos 三天支持 1000 个帕鲁私服
Sealos 的帕鲁私服模板从第一天发布之后就起了 100 多个私服,第二天直接上到 500 多个,第三天直接上千,还在加速增长中.来讲讲我们只用一个晚上怎么做到上线一个专属可用区的,还有一些帕鲁实践 ...
- LeetCode组合总和I~IV和背包问题小结
一.组合总和问题 最近在看leetcode的组合问题,一共四道,总结一下共通之处与不同之处. 原题链接: 组合总和 组合总和II 组合总和III 组合总和IV 对比如下,为了便于对比,将原题目的叙述方 ...
- Rating 算法
Rating 算法 这是一种 OJ 常用的算法,下面进行介绍 公式 $ Rating $ 的计算公式如下: $ Rating = R + K(P - E) $ 这里 $ R $ 表示当前 $ Rati ...
- Oracle-ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
问题描述 ORA-12505, TNS:listener does not currently know of SID given in connect descriptorORA-12505: TN ...
- kafka-Kafka3.4版本创建topic出现zookeeper is not a recognized option
问题描述:在linux云服务器上搭建了一套kafka3.0集群,然后按照以前的创建topic指令: ./kafka-topics.sh --zookeeper hadoop01:2181,hadoop ...