This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Getting "Encrypted Packet decrypted incorrectly (bad NIC)" while 'Pairing' the 2 devices with 'LESC enabled', with the help of nRF_BLE_Sniffer.

I'm trying to pair my device (nRF82382) to nRF Connect (Dev Kit) and using another Dev Kit as a BLE_Sniffer. I'm trying to establish Pairing with LESC enabled. It's Pairing correctly however, after the step where Slave sends a 'LL_START_ENC_REQ', everything from there gives the error "Encrypted packet decrypted incorrectly (bad MIC)". Sending a command from nRF_Connect to the device and reading the stream of data from device to nRF Connect, everything is appearing as "Encrypted packet decrypted incorrectly (bad MIC)". I'm also sharing the log for your better understanding. I'm not doing any data encryption then why is it saying this ? 

Also, very important, when I view data that is being streamed by device on nRF Connect it's showing the right data, then why is sniffer displaying this error?

Can you please explain me what this bad MIC is, why is it showing here and how to resolve this ?

1620	12.076	Master_0x91b041bf	LE 1M	SMP	11	49691	1	1	False	781	Sent Pairing Request: AuthReq: No Bonding, SecureConnection | Initiator Key(s): <none> | Responder Key(s): <none>
1621	12.080	Slave_0x91b041bf	LE 1M	LE LL	0	151	1	0	False	781	Empty PDU
1622	12.126	Master_0x91b041bf	LE 1M	LE LL	0	49602	0	0	False	782	Empty PDU
1623	12.159	Slave_0x91b041bf	LE 1M	SMP	11	150	0	1	False	782	Rcvd Pairing Response: AuthReq: No Bonding, SecureConnection | Initiator Key(s): <none> | Responder Key(s): <none>
1624	12.175	Master_0x91b041bf	LE 1M	LE LL	0	49603	1	1	False	783	Empty PDU
1625	12.178	Slave_0x91b041bf	LE 1M	LE LL	0	151	1	0	False	783	Empty PDU
1626	12.229	Master_0x91b041bf	LE 1M	SMP	69	49689	0	0	False	784	Sent Pairing Public Key
1627	12.233	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	784	Empty PDU
1628	12.272	Master_0x91b041bf	LE 1M	LE LL	0	49139	1	1	False	785	Empty PDU
1629	12.280	Slave_0x91b041bf	LE 1M	SMP	69	150	1	0	True	785	Rcvd Pairing Public Key
1630	12.284	Master_0x91b041bf	LE 1M	LE LL	0	150	0	0	False	785	Empty PDU
1631	12.288	Slave_0x91b041bf	LE 1M	SMP	21	150	0	1	False	785	Rcvd Pairing Confirm
1632	12.326	Master_0x91b041bf	LE 1M	SMP	21	48511	1	1	False	786	Sent Pairing Random
1633	12.329	Slave_0x91b041bf	LE 1M	LE LL	0	151	1	0	False	786	Empty PDU
1634	12.375	Master_0x91b041bf	LE 1M	LE LL	0	49522	0	0	False	787	Empty PDU
1635	12.379	Slave_0x91b041bf	LE 1M	SMP	21	150	0	1	False	787	Rcvd Pairing Random
1636	12.426	Master_0x91b041bf	LE 1M	SMP	21	49522	1	1	False	788	Sent Pairing DHKey Check
1637	12.429	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	788	Empty PDU
1638	12.476	Master_0x91b041bf	LE 1M	LE LL	0	49522	0	0	False	789	Empty PDU
1639	12.479	Slave_0x91b041bf	LE 1M	SMP	21	150	0	1	False	789	Rcvd Pairing DHKey Check
1640	12.525	Master_0x91b041bf	LE 1M	LE LL	0	49524	1	1	False	790	Empty PDU
1641	12.529	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	790	Empty PDU
1642	12.575	Master_0x91b041bf	LE 1M	LE LL	23	49690	0	0	False	791	Control Opcode: LL_ENC_REQ
1643	12.578	Slave_0x91b041bf	LE 1M	LE LL	0	151	0	1	False	791	Empty PDU
1644	12.625	Master_0x91b041bf	LE 1M	LE LL	0	49506	1	1	False	792	Empty PDU
1645	12.629	Slave_0x91b041bf	LE 1M	LE LL	13	150	1	0	False	792	Control Opcode: LL_ENC_RSP
1646	12.675	Master_0x91b041bf	LE 1M	LE LL	0	49587	0	0	False	793	Empty PDU
1647	12.679	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	793	Empty PDU
1648	12.725	Master_0x91b041bf	LE 1M	LE LL	0	49690	1	1	False	794	Empty PDU
1649	12.729	Slave_0x91b041bf	LE 1M	LE LL	1	150	1	0	False	794	Control Opcode: LL_START_ENC_REQ
1650	12.775	Master_0x91b041bf	LE 1M	LE LL	1	49684	0	0	False	795	Encrypted packet decrypted incorrectly (bad MIC)
1651	12.779	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	795	Empty PDU
1652	12.826	Master_0x91b041bf	LE 1M	LE LL	0	49649	1	1	False	796	Empty PDU
1653	12.828	Slave_0x91b041bf	LE 1M	LE LL	1	151	1	0	False	796	Encrypted packet decrypted incorrectly (bad MIC)
1654	12.876	Master_0x91b041bf	LE 1M	LE LL	0	49650	0	0	False	797	Empty PDU
1655	12.878	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	797	Empty PDU
1656	12.925	Master_0x91b041bf	LE 1M	LE LL	0	49691	1	1	False	798	Empty PDU
1657	12.929	Slave_0x91b041bf	LE 1M	LE LL	0	151	1	0	False	798	Empty PDU
1658	12.975	Master_0x91b041bf	LE 1M	LE LL	0	49689	0	0	False	799	Empty PDU
1659	12.977	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	799	Empty PDU
1660	13.025	Master_0x91b041bf	LE 1M	LE LL	0	49691	1	1	False	800	Empty PDU
1661	13.028	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	800	Empty PDU
1662	13.076	Master_0x91b041bf	LE 1M	LE LL	0	49691	0	0	False	801	Empty PDU
1663	13.078	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	801	Empty PDU
1664	13.125	Master_0x91b041bf	LE 1M	LE LL	0	49691	1	1	False	802	Empty PDU
1665	13.129	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	802	Empty PDU
1666	13.175	Master_0x91b041bf	LE 1M	LE LL	0	49691	0	0	False	803	Empty PDU
1667	13.178	Slave_0x91b041bf	LE 1M	LE LL	0	149	0	1	False	803	Empty PDU
1668	13.226	Master_0x91b041bf	LE 1M	LE LL	0	49690	1	1	False	804	Empty PDU
1669	13.228	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	804	Empty PDU
1670	13.275	Master_0x91b041bf	LE 1M	LE LL	0	49691	0	0	False	805	Empty PDU
1671	13.278	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	805	Empty PDU
1672	13.325	Master_0x91b041bf	LE 1M	LE LL	0	49691	1	1	False	806	Empty PDU
1673	13.329	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	806	Empty PDU
1674	13.375	Master_0x91b041bf	LE 1M	LE LL	0	49691	0	0	False	807	Empty PDU
1675	13.378	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	807	Empty PDU
1676	13.425	Master_0x91b041bf	LE 1M	LE LL	0	49690	1	1	False	808	Empty PDU
1677	13.428	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	808	Empty PDU
1678	13.476	Master_0x91b041bf	LE 1M	LE LL	0	49690	0	0	False	809	Empty PDU
1679	13.479	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	809	Empty PDU
1680	13.526	Master_0x91b041bf	LE 1M	LE LL	0	49692	1	1	False	810	Empty PDU
1681	13.528	Slave_0x91b041bf	LE 1M	LE LL	0	149	1	0	False	810	Empty PDU
1682	13.576	Master_0x91b041bf	LE 1M	LE LL	0	49691	0	0	False	811	Empty PDU
1683	13.578	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	811	Empty PDU
1684	13.625	Master_0x91b041bf	LE 1M	LE LL	0	49690	1	1	False	812	Empty PDU
1685	13.628	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	812	Empty PDU
1686	13.675	Master_0x91b041bf	LE 1M	LE LL	0	49691	0	0	False	813	Empty PDU
1687	13.679	Slave_0x91b041bf	LE 1M	LE LL	0	149	0	1	False	813	Empty PDU
1688	13.725	Master_0x91b041bf	LE 1M	LE LL	0	49690	1	1	False	814	Empty PDU
1689	13.734	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	814	Empty PDU
1690	13.775	Master_0x91b041bf	LE 1M	LE LL	0	49691	0	0	False	815	Empty PDU
1691	13.808	Slave_0x91b041bf	LE 1M	LE LL	0	149	0	1	False	815	Empty PDU
1692	13.825	Master_0x91b041bf	LE 1M	LE LL	0	49689	1	1	False	816	Empty PDU
1693	13.828	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	816	Empty PDU
1694	13.876	Master_0x91b041bf	LE 1M	LE LL	0	49690	0	0	False	817	Empty PDU
1695	13.880	Slave_0x91b041bf	LE 1M	LE LL	0	149	0	1	False	817	Empty PDU
1696	13.925	Master_0x91b041bf	LE 1M	LE LL	0	49691	1	1	False	818	Empty PDU
1697	13.928	Slave_0x91b041bf	LE 1M	LE LL	0	151	1	0	False	818	Empty PDU
1698	13.976	Master_0x91b041bf	LE 1M	LE LL	0	49689	0	0	False	819	Empty PDU
1699	13.978	Slave_0x91b041bf	LE 1M	LE LL	0	151	0	1	False	819	Empty PDU
1700	14.025	Master_0x91b041bf	LE 1M	LE LL	0	49690	1	1	False	820	Empty PDU
1701	14.028	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	820	Empty PDU
1702	14.075	Master_0x91b041bf	LE 1M	LE LL	0	49690	0	0	False	821	Empty PDU
1703	14.079	Slave_0x91b041bf	LE 1M	LE LL	0	151	0	1	False	821	Empty PDU
1704	14.125	Master_0x91b041bf	LE 1M	LE LL	0	49690	1	1	False	822	Empty PDU
1705	14.129	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	822	Empty PDU
1706	14.176	Master_0x91b041bf	LE 1M	LE LL	0	49690	0	0	False	823	Empty PDU
1707	14.178	Slave_0x91b041bf	LE 1M	LE LL	0	151	0	1	False	823	Empty PDU
1708	14.226	Master_0x91b041bf	LE 1M	LE LL	0	49690	1	1	False	824	Empty PDU
1709	14.228	Slave_0x91b041bf	LE 1M	LE LL	0	151	1	0	False	824	Empty PDU
1710	14.275	Master_0x91b041bf	LE 1M	LE LL	0	49690	0	0	False	825	Empty PDU
1711	14.278	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	825	Empty PDU
1712	14.326	Master_0x91b041bf	LE 1M	LE LL	0	49691	1	1	False	826	Empty PDU
1713	14.329	Slave_0x91b041bf	LE 1M	LE LL	0	151	1	0	False	826	Empty PDU
1714	14.375	Master_0x91b041bf	LE 1M	LE LL	0	49690	0	0	False	827	Empty PDU
1715	14.379	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	827	Empty PDU
1716	14.425	Master_0x91b041bf	LE 1M	LE LL	0	49690	1	1	False	828	Empty PDU
1717	14.429	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	828	Empty PDU
1718	14.475	Master_0x91b041bf	LE 1M	LE LL	0	49690	0	0	False	829	Empty PDU
1719	14.478	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	829	Empty PDU
1720	14.524	Master_0x91b041bf	LE 1M	LE LL	0	49692	1	1	False	830	Empty PDU
1721	14.527	Slave_0x91b041bf	LE 1M	LE LL	0	150	1	0	False	830	Empty PDU
1722	14.575	Master_0x91b041bf	LE 1M	LE LL	11	49690	0	0	False	831	Encrypted packet decrypted incorrectly (bad MIC)
1723	14.578	Slave_0x91b041bf	LE 1M	LE LL	0	151	0	1	False	831	Empty PDU
1724	14.625	Master_0x91b041bf	LE 1M	LE LL	0	49570	1	1	False	832	Empty PDU
1725	14.628	Slave_0x91b041bf	LE 1M	LE LL	48	150	1	0	False	832	Encrypted packet decrypted incorrectly (bad MIC)
1726	14.675	Master_0x91b041bf	LE 1M	LE LL	11	49274	0	0	False	833	Encrypted packet decrypted incorrectly (bad MIC)
1727	14.679	Slave_0x91b041bf	LE 1M	LE LL	0	151	0	1	False	833	Empty PDU
1728	14.726	Master_0x91b041bf	LE 1M	LE LL	0	49569	1	1	False	834	Empty PDU
1729	14.729	Slave_0x91b041bf	LE 1M	LE LL	9	150	1	0	False	834	Encrypted packet decrypted incorrectly (bad MIC)
1730	14.775	Master_0x91b041bf	LE 1M	LE LL	7	49588	0	0	False	835	Encrypted packet decrypted incorrectly (bad MIC)
1731	14.779	Slave_0x91b041bf	LE 1M	LE LL	0	150	0	1	False	835	Empty PDU
1732	14.826	Master_0x91b041bf	LE 1M	LE LL	0	49602	1	1	False	836	Empty PDU

Parents
  • You can use MITM (Out of Band information)

    You mean 'Passkey' pairing method for authentication ?

    Alright, thanks. Another thing I wanted to ask is if we're using AES encryption method, how do we send the key that is used for encryption, for the receiver to have the same key for decrypting the data? For instance, in AES-CTR, inputs key, nonce and counter to the AES engine returns an encrypted key that is to be used by the receiving end to decrypt the data (by taking exor of cypher text and this encrypted key). If I'm correct, how do I transmit this key? I'm using nRF52810 with SDK v15.2.0 (S112) and also nRF 52832 with SDK 14.0.0 (S132).

  • Manish Kaul said:
    You mean 'Passkey' pairing method for authentication ?

     Yes.

    I don't know how the details regarding this kind of encryption. It should be handled by the peer manager in your application. The keys are used by the softdevice, but it is the peer manager that stores them, so I guess you should be able to dig into the peer manager and see where they are stored if you are interrested.

    Best regards,

    Edvin

  • , As far as I have read about ECDH and also asked on platforms like stack exchange, one thing is clear that ECDH is a secret sharing protocol which essentially means that it's a protocol used to exchange keys over an unencrypted link like AES Key for AES encrypted data. So what I want to ask is, if the above mentioned data is actually being encrypted by an AES protocol and only AES keys are exchange by diffie hellman method and if yes, which AES is being used ? I'm using SDK14.2.0 and backend is micro-ecc+mbedtls.

Reply
  • , As far as I have read about ECDH and also asked on platforms like stack exchange, one thing is clear that ECDH is a secret sharing protocol which essentially means that it's a protocol used to exchange keys over an unencrypted link like AES Key for AES encrypted data. So what I want to ask is, if the above mentioned data is actually being encrypted by an AES protocol and only AES keys are exchange by diffie hellman method and if yes, which AES is being used ? I'm using SDK14.2.0 and backend is micro-ecc+mbedtls.

Children
  • I find it a bit hard to answer this explicitly. Perhaps you can read a bit about BLE security in general, and how it works e.g. from this blog:

    https://www.digikey.com/eewiki/display/Wireless/A+Basic+Introduction+to+BLE+Security

    I guess we don't use the AES terminology directly.

    Basically, there are several levels of security. A link is encrypted if the devices are paired or bonded (bonding is just storing the keys for later connections with the same device). The level of security pretty much depends on how you exchange these keys. You can have "just works" security, where the key will be sent over the air. If someone is sniffing the connection at this point, they will be able to pick up this key. If you use OOB (Out of Band), you can use e.g. a screen on one device and a keyboard on the other to print the key, and to enter it. Hence the key is never sent over the air (OOB). This is one form of MITM (Man in the middle) protections. Another way of sending the keys is to use LESC (ECDH). 

    BR,

    Edvin

Related