-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error flashing the device on Linux #93
Comments
This is because the bootloader is different. From reverse engineering, it seems there is some protection. I would advice you to take a look at https://github.com/iceman1001/ChameleonMini-rebooted/blob/master/Software/Tools/crypt_operations.py and also try the Alternatively, you can try the Windows tools provided in this repository. |
Hi @slurdge, thanks a lot for your prompt response!
It seems to me that these errors happen writing the image, that they're not related to the input file I provide. On windows, the lab401 and your GUI do not recognize the usb device (Windows says it's "unknown" with driver "unknown"). Do you have any advice of where I should look at from here? PS: your code is python3 only! Pull requests welcome? :^) |
@mmaker First, all the work here is done mainly by @iceman1001 and @bogiton if I'm not mistaken. I only happen to be interested by that bit. Your DFU error is quite interesting, I've never seen any like that in my tests. The worst that happened was to me was flashing a non-working firmware. You should always use Can you try to flash the original files with the As for python2, I'm quite sure a PR would be welcome. I just supposed everyone have some py3 laying around nowadays and I'm lazy :-p |
HI, I am not sure what are the "original files" and what the Anyways, I'd like to add that if I try to flash using the dfu-programmer shipped with debin testing (0.6.1-1), I get the following error:
|
oh! Well well from what I recall when I tested on windows and launched that exe directly, I was getting:
after moving libusb0.dll to the same folder. :( |
Please try this : https://github.com/iceman1001/ChameleonMini-rebooted/wiki/Getting-started |
BTW, I have a feeling this might be the "dxls" the key is talking about... |
Whoah, good find! Do you think we can contact this person ? I'm curious ... |
@slurdge Pure guess from a mere "dxls atmel" query on Gogole. Curious as well, but linked profile says last post is from end of 2016 (seems to match RevE works on emsec repo by the way) and nothing since. But from this repo page, "After talks with manufacturer, they also came to the conclusion that it should be open-sourced", so maybe @iceman1001 already chatted with him/them. |
I sure did. We all know who did the hardware. He got dxls to make the gui and modify the firmware, and then afterwards Dxls went on with whatever s/he does. Among the questions I tried to get an answer to was about the encryption. Dxls had already forgotten the code and even the aes key. Back to square zero. This whole reverting of the sourcecode and enhancing it has been a long stretch of puzzling pieces together. The information gathered is all here on the issues / wiki, so it might be very confusing and unorganized. It is more a accurate picture of this project. |
guys , any update or closure on this topic, unfortunately encountering the same issue as @mmaker with the same workflow described further down this topic. |
@0x023 , you should check that your device comes into dfu mode. This is done through the GUI or (if it works on your device), button combination. If you confirm that your device is in dfu mode (in device explorer) and even the .exe method doesn't work, then it means there's a new way of communicating. Your device comes from ? |
@slurdge When I use scramblehex on firmware and eeprom, I get:
|
@exander77 Can you provide me with the hex files? I'll look into it. |
@slurdge Thank you: https://nextcloud.shy.cz/index.php/s/oaACo8fLB6XsN3H I have set these variables:
I made it this way:
I am trying to flash it this way (/dev/ttyACM0 is my device):
It goes to bootloader without problems and it gives me a version and it resets at the end. But both eeprom and firmware flashing gives me:
|
Thanks. I'll look into it (however I'm on/off next week, sorry if I can't answer quickly). |
@slurdge Not a problem, thank you very much! |
@slurdge I have USBTinyISP, it may work as well. I will try it. |
@exander77 I looked at the files, and they seem correct. However I do not have my Chameleon with me so I can't try the full dfu-programmer. |
@exander77 The error displayed is because the dfu-programmer is too old. Try with a recent version. It works for me with newer versions. |
Confirm this worked perfectly with the following sequence, on OSX and GNU/Linux, with dfu-programmer 0.7.2 (latest, either from Hombrew in OSX, or from Github repo in GNU/Linux), after putting the Chameleon in boot loader mode (black button pressed while plugging):
It may be time to update wiki + Makefile and accept we have to stick the original bootloader and scrambling intermediary step for now; just to limit such issues. |
So happy it worked for you <3 ! |
Thanks a lot for this reverse engineering work. Too late, I made things clear in Linux flashing wiki page now, I think. I even guess these issues could be closed :) |
We should do some shell scripts for easy flashing, like we have over at proxmark repos |
That is the purpose of PR #111: Makefile will endorse the "shell script" role, by just calling ones that exist already. "make dfu-prog" will build firmware and flash-it right away on OSX and GNU/Linux. |
yes, but that PR removes backwards functionality... |
@mmaker has your issues been resolved using the latest code as of today? |
And, @ShinHub , email me. |
@iceman1001 oh I am going to be rumbled so much... I knew trying to get issues closed would get me in trouble :( |
@slurdge , sorry if I do not understand anything as this is quite new to me, but I may have a theory I'd like to have your opinion on.
So my theory is that one should be able to:
A part from that, I wonder if the strange "scramble" (not the AES round) that we have to reverse to flash an app from original RevE bootloader would not be related to the way the Flash is written (see AVR1316, title 2.2, atomic vs. split write. The second would need kind of XOR/ORing operations to write with SPM). |
@ShinHub No problems! However, I think the problem is with the Lock bits. As per the manual (8331 4.16.6), I dumped the lock bits and they both are:
So; unless we find a workaround, it would be hard to unlock. IIRC some people did got around these limitations on some AtMels, but that is quite a bit of work. As for the XOR, I'm pretty sure it's not in the original bootloader and, if needed, wouldn't be done on the PC side. |
@slurdge thanks taking time answering my mashup. Great, I am happy it was not just my will, and that such a flow makes sense... I would have loved trying something like that. Thanks taking time checking with locks bits as well, as it was my next question. I'll continue to read here and there... I hope there is a way around this still, cause next step is looking for vulnerabilities to exploit in bootloader. One last question though, how come the lock bits prevent a write from programmer, but you managed to write another bootloader with AVRISP, isn't it? |
@slurdge oh, now I get it. From the manual (8331, just where you pointed at) : "bits can only be written to a more strict locking. Resetting the bits is possible only by executing a chip erase command". And such a command, of course, is only (and always) possible with a hardware programmer like AVRISPmkII. So can we say it is a dead end to program bootloader of ChameleonMini RevE rebooted as we get them with a mere software kungfu? |
@ShinHub Yes. BUT. Maybe the lock is incorrectly put on some devices. Maybe we can also find a way to sidestep the issue. However I didn't find right now any way to do that. |
@slurdge @iceman1001 |
@ShinHub is this documented on the wiki in a clear way? |
@iceman1001 Yes it is, plus the recent changes in Makefile to ease flashing in both locked and unlocked conditions. |
hi,
I have a Chamelon RevE rebooted from lab401.
Running the flash command as provided in the wiki I get:
Following https://store.ryscc.com/blogs/news/upgrading-the-firmware-on-a-chameleonmini I then tried to use:
Thinking that the flash would not be written if there was already non-zero data.
In both cases, the commands fail with an error. Where can I go from here?
I am using dfu-programmer revision 5254ee489f0048c36f1af660f2354a7746b3f8cc
Debian testing with libusb version 2:1.0.22-2, and
lsusb
gives me:Meaning only the bootloader is left in my device :( and the WIndows GUI does not seem to recognize the Chamelon anymore. Is there any chance you could help me out with this?
The text was updated successfully, but these errors were encountered: