XiaomiFirmwareUpdater / miui_arb_checker

GNU General Public License v3.0
2 stars 3 forks source link

Incorrect ARB indices for Recovery ZIPs #2

Closed IgorEisberg closed 4 months ago

IgorEisberg commented 5 years ago

From your source code:

def main():
    """
    check anti-rollback index in xbl file
    """
    file_type = check_file()
    makedirs("tmp", exist_ok=True)
    file = argv[1]
    if file_type == 'zip':
        print('Checking ARB from Recovery ROM')
        extract_zip(file)
        **check_file()**
    elif file_type == 'tgz':
        print('Checking ARB from Fastboot ROM')
        extract_tar(file)
        check_flash_script()
    else:
        print("Something went wrong!")
    rmtree("tmp/")

1) You sure about that line? Shouldn't it be check_xbl(), which isn't used anywhere in the script? 2) Even if replaced with check_xbl(), the returned value is incorrect. Returns false indexes for known "anti: 4" ROMs: 3 for whyred and 1 for dipper. Only indicates that the check_xbl() looks for the wrong thing. 3) Besides **xbl.* (xbl.elf and xbl.img) there's also sbl1.mbn on sakura (known "anti: 4" device as well), and if modified check_xbl() to read that too, returns: 2**

yshalsager commented 5 years ago

Hello @IgorEisberg, Thanks for reporting.

  1. It's my mistake. I've fixed in the last commit.
  2. To be honest, I don't know why it gives a wrong index. As you see, it checks for arb string inside xbl file, which returns in case of whyred ['0000000300000000']. If you have a better idea for checking feel free to suggest it.
  3. I didn't know about it, thanks for explaining.
IgorEisberg commented 5 years ago
  1. My team looks into a method for checking ARB index from Recovery ROMs as well (as we got no use for Fastboot ROMs), so we've got no solution as of yet. Just curious as to why do you think that that string is the ARB index and not something entirely unrelated. As we can see it, while the Fastboot ROMs of affected devices all have index of 4 in their flashing script, the fact that these strings don't match that would indicate that they are unrelated to ARB.
yshalsager commented 5 years ago

@IgorEisberg, according to this guide ARB offset is 148B. But seems this is not a standard for every ARB enabled device.

ale8530 commented 5 years ago

I have considered the arb question better, this tool probably cannot give the correct "anti" value in all the cases but it allows to identify if it has had an increase from 2. If this 2,3 or 4 arb tool is active