Search code examples
swiftassemblyx86-64disassemblyida

Swift MAC app failed to laucnh after being patched by IDA


I'm new to reverse engineering on Apple Devices and i have developed a very very simple crack me for learning purposes! everything works fine, but when i open my binary file in IDA and change the condition instruction, and apply the patch, my app starts to failing on launch!

there are 2 ways i can crack the code, first by changing the condition statement from JNZ to JZ, and the other way NOP the JMP function below the JNZ instruction.

__text:0000000100001387                 mov     rdi, [rbp+var_68]
__text:000000010000138B                 call    _objc_release
__text:0000000100001390                 mov     al, [rbp+var_81]
__text:0000000100001396                 test    al, 1
__text:0000000100001398                 jnz     short loc_10000139F// Goes for Correct condition
__text:000000010000139A                 jmp     loc_100001475 //goes for incorrect condition

in C and other languages which i have experience in reverse engineering, these solutions would work.does any one have any clue what is going here?

Edit

here is my crack me code in swift!

import Cocoa

class ViewController: NSViewController {

    @IBAction func btn(_ sender: Any) {

        if(input.stringValue == "!@#><1234")
        {
            let box = NSAlert()
            box.alertStyle = .informational
            box.messageText = "Cool!"
            box.runModal()
        }else{
            let box = NSAlert()
            box.alertStyle = .critical
            box.messageText = "Not Cool!"
            box.runModal()
        }
    }

    @IBOutlet weak var input: NSTextField!

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override var representedObject: Any? {
        didSet {

        }
    }
}

SOLUTION

it was a code signing problem within its binary. i think when we apply a patch and change the binary, OS doesn't allow the app to be executed. so i just resigned my app and now it is cracked and working.


Solution

  • SOLUTION

    it was a code signing problem within its binary. i think when we apply a patch and change the binary, OS doesn't allow the app to be executed. so i just resigned my app and now it is cracked and working.