This is really not my work but came across while searching.
Tried on My htc one s worked flawlessly:
So to flash a stock rom we need to have a generic HTC cid follow the steps below:
1. Fire up your command prompt and go to the directory that you have ADB installed to. Type "adb shell" and hit enter.
2. Type "su" and hit enter. You now have root privileges.
3. Next type "dd if=/dev/block/mmcblk0p4 of=/sdcard/mmcblk0p4" and hit enter. This will dump the partition to your sdcard.
4. Next type "exit", hit enter, type "exit", and hit enter again. This should take you back to a command prompt for your computer.
5. type "adb pull /sdcard/mmcblk0p4" and hit enter. NOTE THE SIZE OF THE FILE BEFORE THE NEXT STEP!
6. Open the file (mmcblk0p4) with your hex editor.
7. Look for offset 00000210 and you should see T-MOB005 with your IMEI number attached to it.
( MY CID WAS T-MOB005 YOUR MAT BE DIFFERENT)
8. Change T-MOB005 to HTC__001 and save the file as mmcblk0p4MOD. This will give you SuperCID as well but instead of HTC__001 you have to put 11111111.But I think supercid does not get OTA updates. So better stay with generic HTC cid.
MAKE SURE AT THIS POINT THAT THE FILE IS THE EXACT SIZE IT WAS BEFORE YOU HEX EDITED IT!
Remember change 8 numbers with 8 in your cid and do not delete the IMEI make sure you match it before going forward
9. Now go back to your command prompt and type "adb push mmcblk0p4MOD /sdcard/mmcblk0p4MOD" and hit enter.
10. Type "adb shell" and hit enter then type "su" and hit enter again. This will put you back into the android shell and give you root privileges.
11. Type "dd if=/sdcard/mmcblk0p4MOD of=/dev/block/mmcblk0p4" and hit enter.
To test if it worked restart the phone into fastboot (type "adb reboot bootloader" and hit enter) and once the bootloader screen comes up type "fastboot oem readcid" and hit enter. It should read "HTC__001".
Now flash a stock recovery and stock boot. Relock your bootloader.
Run a stock rom.
Just rember to unlock your boot loader again you will need to run
fastboot oem get_identifier_token
again submit to HTCdev and get a new file
Do not use the previous one.
Hope you have all the files need if not look on the other post or let me know will upload them.