ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๊ฐœ์š”

iOS์—์„œ๋Š” ์„ค์น˜๋œ ์•ฑ ๊ฐ„์— ์‚ฌ์šฉ์ž์˜ ํŽธ์˜์„ฑ์„ ์œ„ํ•œ "๊ณต์œ  ํด๋ฆฝ๋ณด๋“œ"๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์‹คํ–‰ ์ค‘์ธ ์•ฑ์—์„œ ์ผ๋ถ€ ํ…์ŠคํŠธ๋ฅผ "๋ณต์‚ฌ" ๋˜๋Š” "์ž˜๋ผ๋‚ด๊ธฐ"์‹œ -> pasteboard ๋ฒ„ํผ์— ์ €์žฅ๋˜๋ฉฐ ์ด๋Š” ๋‹ค๋ฅธ ์•ฑ์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์กฐ์‹ฌํ•ด์•ผ ๋  ํ•„์š”๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด ์•ฑ ๋‚ด๋ถ€์— ๋‹จ์ˆœ ์ €์žฅ๋˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ ๋‹จ๋ง ์žฅ์น˜ ๋‚ด๋ถ€์— ๋ฒ„ํผ ํ˜•ํƒœ๋กœ ๊ธฐ๋ก๋˜๊ธฐ์— ๋‹ค๋ฅธ ์•ฑ์„ ํ†ตํ•ด ์ด ๊ฐ’์„ ํ˜ธ์ถœํ•˜์—ฌ ์œ ์ถœํ•  ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

 

์„œ๋กœ ๊ฐ„์— ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋Š” ํด๋ฆฝ๋ณด๋“œ๋ฅผ ์• ํ”Œ์—์„œ๋Š” Pasteboard๋ผ๊ณ ๋„ ๋ถ€๋ฆ…๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ๊ด€์ ์—์„œ ๋ณด์ž๋ฉด ์ด ๊ธฐ๋Šฅ์€ ๋งค์šฐ ํŽธ๋ฆฌํ•˜๊ณ  ํ•„์ˆ˜์ ์ธ ์—ญํ• ๋กœ ์ž๋ฆฌ ์žก์•„ ์žˆ์Šต๋‹ˆ๋‹ค. ๋งˆ์น˜ ๊ธด ๋ฐ์ดํ„ฐ ํ˜•ํƒœ๋ฅผ ๊ฐ€์ง€๋Š” ์—ฐ๋ฝ์ฒ˜, ์ฃผ์†Œ, ์นด๋“œ๋ฒˆํ˜ธ ๋“ฑ์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„  ๋ณดํ†ต ๋ณต์‚ฌ ๋ฐ‘ ๋ถ™์—ฌ ๋„ฃ๊ธฐ๋ฅผ ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

 

Example ์ฝ”๋“œ

NSLog(@"clipboard = %@", [UIPasteboard generalPasteboard].string);

์•ฑ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ Clipboard๋ฅผ ์ฝ๊ธฐ ์œ„ํ•ด์„  ์œ„์˜ ์ฝ”๋“œ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์ ์šฉํ•˜๋Š” ๋ฒ•์ด ๊นŒ๋‹ค๋กœ์šด ํŽธ์— ์†ํ•˜์ง„ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ํ•„์š”๋กœ ํ•˜๋Š” ์•ฑ์ด๋ผ๋ฉด ๋Œ€๋ถ€๋ถ„ ์ ์šฉ๋˜์–ด ์žˆ์„ ๊ฒ๋‹ˆ๋‹ค.

 

์ด๋Ÿฌํ•œ ํŽธ๋ฆฌ ๊ธฐ๋Šฅ์ด ์•„๋ฌด๋Ÿฐ ์ œ์•ฝ ์—†์ด ๋ฌด์ œํ•œ ์ ์œผ๋กœ ๋ฐ์ดํŠธ์— ์•ก์„ธ์Šค ํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด ์–ด๋–ค ๋ฌธ์ œ๊ฐ€๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์„๊นŒ์š”? ์˜ˆ๋ฅผ ๋“ค์–ด ์‚ฌ์šฉ์ž๊ฐ€ ๋งˆ์ง€๋ง‰์œผ๋กœ ๋ณต์‚ฌํ•œ ๋ฐ์ดํ„ฐ๊ฐ€ ๊ธˆ์œต๊ณผ ๊ด€๋ จ๋œ ๋ฏผ๊ฐํ•œ ์ •๋ณด์ธ ์ƒํƒœ์—์„œ ์•ˆ์ „ํ•˜์ง€ ์•Š์€ ๊ณณ ๋˜๋Š” ๋ถ„์‹คํ•œ ์ƒํƒœ๋กœ ๋ฐฉ์น˜๋  ๊ฒฝ์šฐ ๊ณต๊ฒฉ์ž๋Š” ๊ฐ’์„ ๋ฌด๋‹จ์œผ๋กœ ์ถ”์ถœํ•˜์—ฌ ์œ ์ถœํ•  ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

 

์ทจ์•ฝํ•œ ์•ฑ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋Œ€์ƒ์œผ๋กœ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ฐ’์ด ๋“ค์–ด๊ฐ€๋Š” ๋ถ€๋ถ„์ด ๊ณ„์ขŒ๋ฒˆํ˜ธํ™” CVC ๋„˜๋ฒ„๋ง์„ ๋ฐ›๋Š” ํŽ˜์ด์ง€์—์„œ "Copy"๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

 

https://github.com/interference-security/frida-scripts/blob/master/iOS/pasteboard-monitoring.js

 

GitHub - interference-security/frida-scripts: Frida Scripts

Frida Scripts. Contribute to interference-security/frida-scripts development by creating an account on GitHub.

github.com

pasteboard ๋ฒ„ํผ์— ๊ธฐ๋ก๋œ ๊ฐ’์„ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด ์œ„ ๋งํฌ์— ์ฒจ๋ถ€๋œ frida script๋ฅผ ์‚ฌ์šฉํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

//Twitter: https://twitter.com/xploresec
//GitHub: https://github.com/interference-security
function start_pasteboard_monitoring(interval_value)
{
    var pasteboard = (ObjC.classes.UIPasteboard).generalPasteboard();
    var latest_word = "";
    setInterval(function(){
        try
        {
        //๋ณต์‚ฌ๋œ ๊ฐ’์„ ๋ฌธ์ž์—ด ํ˜•์‹์œผ๋กœ ์ ธ์™€์„œ on_pasteboard ๋ผ๋Š” ๋ณ€์ˆ˜์— ๋‹ด์Œ
            var on_pasteboard = pasteboard.string().toString() 
        //latest_word์—๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ๋นˆ ๊ฐ’์ด๋ฉฐ ๋ณต์‚ฌ๋œ ๋ฌธ์ž์—ด๊ณผ ๋™์ผํ•˜์ง€ ์•Š์œผ๋ฉด “Found on pasteboard”๋ผ๋Š” ์ฝ˜์†”๋กœ๊ทธ์™€ ํ•จ๊ป˜ ๊ฐ’์ด ์ถœ๋ ฅ๋จ
            if(on_pasteboard != latest_word) 
            {
                console.log("[*] Found on pasteboard: "+ on_pasteboard);
        //๋ณต์‚ฌ๋œ ๊ฐ’์€ latest_word์— ๋‹ค์‹œ ๋“ค์–ด๊ฐ€์„œ ๋น„๊ต ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ƒ๋‹จ์˜ ๋น„๊ต๋ฌธ์— ๊ฑธ๋ ค ์ค‘๋ณต๋œ ๊ฐ’์ด ์ฝ˜์†”๋กœ๊ทธ์— ์ฐํžˆ์ง€ ์•Š๊ฒŒ ๋˜์–ด ์žˆ์Œ
                latest_word = on_pasteboard; 
            }
        }
        catch(err)
        {
            a = "";
        }
    }, interval_value);

}
//start_pasteboard_monitoring(INTERVAL_VALUE_HERE_MILLISECONDS)
start_pasteboard_monitoring(2000)

interval_value๋ฅผ ์ธ์ž๋กœ ์ง€์ •ํ›„ setInterval์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‚ด๋ถ€ ์ฝ”๋“œ๋ฅผ -> start_pasteboard_monitoring(2000)์— ์˜ํ•ด 2์ดˆ๋งˆ๋‹ค ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋„๋ก ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

 

์‹คํ–‰ ์ค‘์ธ ํ”„๋กœ์„ธ์Šค๋ฅผ ํ™•์ธํ•ด๋ณด๋ฉด DVIA-v2์•ฑ์€ ์‹คํ–‰๋˜๊ณ  ์žˆ์ง€ ์•Š์œผ๋ฉฐ pasteboard ์ทจ์•ฝ์ ์ด ์กด์žฌํ•  ๊ฒฝ์šฐ ๋‹ค๋ฅธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ๋„ ์ €์žฅ๋œ ๊ฐ’์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

POC ์ฝ”๋“œ๋ฅผ “Safari” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— attach ํ•ด๋ณด๋ฉด์•ฑ์— ์ €์žฅ๋˜์—ˆ๋˜ ๊ฐœ์ธ์ •๋ณด๊ฐ€ ์ฝ˜์†” ๋กœ๊ทธ์— ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

 

๋Œ€์‘๋ฐฉ์•ˆ

UIPasteboard ํด๋ž˜์Šค์—์„œ ๊ธฐ๊ธฐ๊ฐ„์˜ ๋ณต์‚ฌ ๋ฐ์ดํ„ฐ๊ฐ€ ๊ณต์œ ๋˜๋Š”๋ฐ, ์ €์žฅ๋˜๋Š” ์ข…๋ฅ˜์™€ ๋งŒ๋ฃŒ ์‹œ์ ์„ ์ตœ์†Œํ•œ์œผ๋กœ ์„ค์ •ํ•˜์—ฌ ๊ตฌํ˜„ํ•˜๊ฑฐ๋‚˜ ์ค‘์š”ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค๋ฃจ๋Š” ์˜์—ญ์€ ์ผ๋ฐ˜์ ์ธ General Pasteboard ๋ฐฉ์‹์ด ์•„๋‹Œ "Custom Pasteboard" ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ ๊ธˆ์œต๊ถŒ์—์„œ ์‰ฝ๊ฒŒ ๋ณผ ์ˆ˜ ์žˆ๋Š” "๊ฐ€์ƒ ํ‚คํŒจ๋“œ"๋ฅผ ํ†ตํ•ด ๊ฐ’ ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ฃผ๋Š” ๊ฒƒ์ด ์•ˆ์ „ํ•ฉ๋‹ˆ๋‹ค.

๊ณต์œ ํ•˜๊ธฐ ๋งํฌ
Comment