Nitrokey / libnitrokey

Communicate with Nitrokey devices in a clean and easy manner
https://nitrokey.com/
GNU Lesser General Public License v3.0
65 stars 34 forks source link

Accepting response to a different command #78

Open ignatenkobrain opened 7 years ago

ignatenkobrain commented 7 years ago

There is bug reported in Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1507245

Not sure if it's libnitrokey or nitrokey-app though.

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
        set = {__val = {0, 140042244579249, 140042275851608, 0, 140042275851608, 140729576292400, 140729576292384, 4835471521, 140042275850752, 140042244159519, 4294967295, 140042275726560, 140042234240896, 140042275727808, 140042275851608, 140729576292480}}
        pid = <optimized out>
        tid = <optimized out>
#1  0x00007f5e1fa343b1 in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {0, 140042238277184, 3432, 0, 140042238277315, 140042238260224, 140042247651144, 140729576292848, 94131468259632, 140042275665424, 140042275665424, 1, 140042275651600, 140041837910800, 0, 140042275651600}}, sa_flags = 540912976, sa_restorer = 0x7f5e21d6ee60}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007f5e203de025 in __gnu_cxx::__verbose_terminate_handler () at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
        terminating = true
        t = <optimized out>
#3  0x00007f5e203dbc16 in __cxxabiv1::__terminate (handler=<optimized out>) at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
No locals.
#4  0x00007f5e203dbc61 in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
No locals.
#5  0x00007f5e203dbea4 in __cxxabiv1::__cxa_throw (obj=obj@entry=0x7f5e08009b80, tinfo=0x559caf0a21d0 <typeinfo for CommandFailedException>, tinfo@entry=0x7f5e21f87d60 <typeinfo for CommandFailedException>, dest=dest@entry=0x7f5e21ca0a10 <CommandFailedException::~CommandFailedException()>) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:93
        globals = <optimized out>
        header = 0x7f5e08009b00
#6  0x00007f5e21d1b169 in nitrokey::proto::Transaction<(nitrokey::proto::CommandID)3, nitrokey::proto::stick10::ReadSlot::CommandPayload, nitrokey::proto::stick10::ReadSlot::ResponsePayload>::run (dev=std::shared_ptr (count 2, weak 0) 0x559cb0eb6150, payload=...) at /usr/src/debug/libnitrokey-3.1-1.fc27.x86_64/include/device_proto.h:437
        __FUNCTION__ = "run"
        guard = {_M_device = @0x7f5e21f89140}
        status = <optimized out>
        outp = {_zero = 0 '\000', command_id = nitrokey::proto::CommandID::GET_STATUS, {_padding = '\000' <repeats 58 times>, payload = {slot_number = 0 '\000'}}, crc = 0}
        resp = {static storage_status_padding_size = <optimized out>, _zero = 0 '\000', device_status = 0 '\000', command_id = 3 '\003', last_command_crc = 776195886, last_command_status = 3 '\003', {_padding = '\000' <repeats 52 times>, payload = {slot_name = '\000' <repeats 14 times>, {_slot_config = 0 '\000', {use_8_digits = false, use_enter = false, use_tokenID = false}}, {slot_token_id = '\000' <repeats 12 times>, slot_token_fields = {omp = "\000", tt = "\000", mui = "\000\000\000\000\000\000\000", keyboard_layout = 0 '\000'}}, {slot_counter = 0, slot_counter_s = "\000\000\000\000\000\000\000"}}, storage_status = {_storage_status_padding = '\000' <repeats 12 times>, command_counter = 0 '\000', command_id = 0 '\000', device_status = 0 '\000', progress_bar_value = 0 '\000'}}, crc = 1105697817}
        successful_communication = false
        receiving_retry_counter = <optimized out>
        sending_retry_counter = <optimized out>
#7  0x00007f5e21c9c635 in nitrokey::NitrokeyManager::get_OTP_slot_data (this=this@entry=0x559cb0e71130, slot_number=<optimized out>) at /usr/src/debug/libnitrokey-3.1-1.fc27.x86_64/NitrokeyManager.cc:854
        p = {slot_number = 32 ' '}
        data = {packet = {static storage_status_padding_size = <optimized out>, _zero = 112 'p', device_status = 137 '\211', command_id = 103 'g', last_command_crc = 8388136, last_command_status = 0 '\000', {_padding = "h\211g(\376\177\000\000\000\000\000\000\000\000\000\000\240\211g(\376\177\000\000`\211g(\376\177\000\000\261\375\343\256\234U\000\000\260\037\351\260\234U\000\000\000\063\373|\354", payload = {slot_name = "h\211g(\376\177\000\000\000\000\000\000\000\000", {_slot_config = 0 '\000', {use_8_digits = false, use_enter = false, use_tokenID = false}}, {slot_token_id = "\240\211g(\376\177\000\000`\211g(\376", slot_token_fields = {omp = "\240\211", tt = "g(", mui = "\376\177\000\000`\211g(", keyboard_layout = 254 '\376'}}, {slot_counter = 11290211994600210559, slot_counter_s = "\177\000\000\261\375\343\256\234"}}, storage_status = {_storage_status_padding = "h\211g(\376\177\000\000\000\000\000\000", command_counter = 0 '\000', command_id = 0 '\000', device_status = 0 '\000', progress_bar_value = 160 '\240'}}, crc = 1948323}}
#8  0x00007f5e21c9c755 in nitrokey::NitrokeyManager::get_TOTP_slot_data (this=0x559cb0e71130, slot_number=slot_number@entry=0 '\000') at /usr/src/debug/libnitrokey-3.1-1.fc27.x86_64/NitrokeyManager.cc:859
No locals.
#9  0x0000559caee162f8 in MainWindow::displayCurrentTotpSlotConfig (this=this@entry=0x7ffe28679950, slotNo=<optimized out>) at /usr/src/debug/nitrokey-app-1.2-0.2.beta.3.fc27.x86_64/src/ui/mainwindow.cpp:424
        p = {slot_name = "\260\211g(\376\177\000\000\t\000\000\000\000\000", {_slot_config = 0 '\000', {use_8_digits = false, use_enter = false, use_tokenID = false}}, {slot_token_id = "--error--\000[!^", slot_token_fields = {omp = "--", tt = "er", mui = "ror--\000[!", keyboard_layout = 94 '^'}}, {slot_counter = 18314001792871956607, slot_counter_s = "\177\000\000P\231g(\376"}}
        interval = <optimized out>
        cardSerial = "00003202"
#10 0x0000559caee16a0d in MainWindow::displayCurrentSlotConfig (this=0x7ffe28679950) at /usr/src/debug/nitrokey-app-1.2-0.2.beta.3.fc27.x86_64/src/ui/mainwindow.cpp:494
        slotNo = <optimized out>
#11 0x0000559caee16a25 in MainWindow::on_slotComboBox_currentIndexChanged (this=<optimized out>) at /usr/src/debug/nitrokey-app-1.2-0.2.beta.3.fc27.x86_64/src/ui/mainwindow.cpp:650
No locals.
#12 0x0000559caee547d4 in MainWindow::qt_static_metacall (_o=_o@entry=0x7ffe28679950, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=40, _a=_a@entry=0x7ffe28678b90) at /usr/src/debug/nitrokey-app-1.2-0.2.beta.3.fc27.x86_64/x86_64-redhat-linux-gnu/nitrokey-app_autogen/YPKJ5OE7LN/moc_mainwindow.cpp:375
        _t = 0x7ffe28679950
#13 0x0000559caee56205 in MainWindow::qt_metacall (this=0x7ffe28679950, _c=QMetaObject::InvokeMetaMethod, _id=40, _a=0x7ffe28678b90) at /usr/src/debug/nitrokey-app-1.2-0.2.beta.3.fc27.x86_64/x86_64-redhat-linux-gnu/nitrokey-app_autogen/YPKJ5OE7LN/moc_mainwindow.cpp:520
No locals.
#14 0x00007f5e2094ac94 in ?? ()
No symbol table info available.
#15 0x00007ffe28678b10 in ?? ()
No symbol table info available.
#16 0x0000000000000000 in ?? ()
No symbol table info available.

You can find full backtrace, coredump and more information in bugzilla.

szszszsz commented 7 years ago

Report details: Nitrokey Pro v0.8 Fedora 27 x64 Nitrokey App crash on viewing OTP slot details in due to unexpected response of the device Possible cause: accepting a response from a different command (PWS status response on reading slot) due to not checking CRC (recently disabled; v3.1 https://github.com/Nitrokey/libnitrokey/commit/e0284726110bcdcccb6b8fe6c84466cd6c14c612 ) App logs: https://bugzilla.redhat.com/attachment.cgi?id=1344818

Not reproducible under Ubuntu 17.04.