Skip to content
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

port cve-2021-34600 poc, fix device desfire aes crypto #1594

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
make style
  • Loading branch information
y-x41 committed Feb 9, 2022
commit c53dc84e6190edf94eb5105d91572fc7aa908e1f
6 changes: 3 additions & 3 deletions client/src/cmdhfcipurse.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static int CLIParseCommandParametersEx(CLIParserContext *ctx, size_t keyid, size
if (CLIParamHexToBuf(arg_get_str(ctx, aidid), hdata, hdatalen, &hdatalen)) {
return PM3_ESOFT;
}

if (hdatalen && (hdatalen < 1 || hdatalen > 16)) {
PrintAndLogEx(ERR, _RED_("ERROR:") " application id length must be 1-16 bytes only");
return PM3_EINVARG;
Expand Down Expand Up @@ -1466,7 +1466,7 @@ static int CmdHFCipurseUpdateKey(const char *Cmd) {
arg_int0(NULL, "newkeyn", "<dec>", "target key ID"),
arg_str0(NULL, "newkey", "<hex 16 byte>", "new key"),
arg_str0(NULL, "newkeya", "<hex 1 byte>", "new key additional info. 0x00 by default"),

arg_int0(NULL, "enckeyn", "<dec>", "encrypt key ID (must be equal to the key on the card)"),
arg_str0(NULL, "enckey", "<hex 16 byte>", "encrypt key (must be equal to the key on the card)"),

Expand Down Expand Up @@ -1541,7 +1541,7 @@ static int CmdHFCipurseUpdateKey(const char *Cmd) {
uint8_t encKey[CIPURSE_AES_KEY_LENGTH] = CIPURSE_DEFAULT_KEY;
if (hdatalen)
memcpy(encKey, hdata, CIPURSE_AES_KEY_LENGTH);

bool noauth = arg_get_lit(ctx, 15);
bool needCommit = arg_get_lit(ctx, 16);

Expand Down
2 changes: 1 addition & 1 deletion client/src/cmdhfmfdes.c
Original file line number Diff line number Diff line change
Expand Up @@ -4998,7 +4998,7 @@ static int CmdHF14ADesWriteData(const char *Cmd) {
arg_lit0(NULL, "debit", "use for value file debit operation instead of credit"),
arg_lit0(NULL, "commit", "commit needs for backup file only. For the other file types and in the `auto` mode - command set it automatically"),
arg_int0(NULL, "updaterec", "<dec>", "Record number for update record command. Updates record instead of write. Lastest record - 0"),
arg_str0(NULL, "isoid" , "<hex>", "Application ISO ID (ISO DF ID) (2 hex bytes, big endian)"),
arg_str0(NULL, "isoid", "<hex>", "Application ISO ID (ISO DF ID) (2 hex bytes, big endian)"),
arg_str0(NULL, "fileisoid", "<hex>", "File ISO ID (ISO DF ID) (2 hex bytes, big endian). Works only for ISO write commands"),
arg_str0(NULL, "readerid", "<hex>", "reader id for CommitReaderID command. If present - the command issued before write command"),
arg_str0(NULL, "trkey", "<hex>", "key for decode previous reader id"),
Expand Down
2 changes: 1 addition & 1 deletion client/src/cmdhfmfp.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ static int CmdHFMFPWrbl(const char *Cmd) {

void *argtable[] = {
arg_param_begin,
arg_lit0("v", "verbose", "Verbose mode"),
arg_lit0("v", "verbose", "Verbose mode"),
arg_lit0("b", "keyb", "Use key B (def: keyA)"),
arg_int1(NULL, "blk", "<0..255>", "Block number"),
arg_str1("d", "data", "<hex>", "Data, 16 hex bytes"),
Expand Down
20 changes: 10 additions & 10 deletions client/src/cmdhfmfu.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,22 @@ static int ul_print_nxp_silicon_info(uint8_t *card_uid) {
uint16_t waferCoordX = ((uid[6] & 3) << 8) | uid[1];
uint16_t waferCoordY = ((uid[6] & 12) << 6) | uid[2];
uint32_t waferCounter = (
(uid[4] << 5) |
((uid[6] & 0xF0) << 17) |
(uid[5] << 13) |
(uid[3] >> 3)
);
(uid[4] << 5) |
((uid[6] & 0xF0) << 17) |
(uid[5] << 13) |
(uid[3] >> 3)
);
uint8_t testSite = uid[3] & 7;

PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Silicon Information"));
PrintAndLogEx(INFO, " Wafer Counter: %" PRId32 " ( 0x%02" PRIX32 " )", waferCounter, waferCounter);
PrintAndLogEx(INFO, " Wafer Coordinates: x %" PRId16 ", y %" PRId16 " (0x%02" PRIX16 ", 0x%02" PRIX16 ")"
, waferCoordX
, waferCoordY
, waferCoordX
, waferCoordY
);
, waferCoordX
, waferCoordY
, waferCoordX
, waferCoordY
);
PrintAndLogEx(INFO, " Test Site: %u", testSite);
return PM3_SUCCESS;
}
Expand Down
2 changes: 2 additions & 0 deletions client/src/pm3line_vocabulory.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ const static vocabulory_t vocabulory[] = {
{ 0, "hf cipurse formatall" },
{ 0, "hf cipurse create" },
{ 0, "hf cipurse delete" },
{ 0, "hf cipurse updkey" },
{ 0, "hf cipurse updakey" },
{ 0, "hf cipurse default" },
{ 1, "hf cipurse test" },
{ 1, "hf epa help" },
Expand Down
Loading