Does this scheme achieve my requirements? Does the truncation of the last 48 bits pose a security risk?
The scheme is broken by a passive adversary who gets a single pair $(t,r)$. Observe that the last 48 bits of the key can be recovered as $K[:48] = t \oplus r$. Therefore, the attacker can now send arbitrary $(t^*, r^*)$ values that the receiver will accept. Recalling that the verifier does the following
$r' = t' \oplus K$ (only keep last 48 bits); verify $r = r'$
We see that knowledge of the rest of the key is not needed.
Besides, 48 bits values offer low collision protection, but that may be fine for your application...
Replay: a more straightforward attack is to replay the pair $(r, t)$. The description doesn't say how the receiver checks for this.
Potential solution: From the initial description, it seems as if the receiver is fairly limited computationally speaking, and they can only compute xors are most and not the AES-CTR, for example. Which would be odd with the following
so, there is some sort of pre-authentication that has already happened but it is not of importance here
Anyway, a possible solution is using two pseudo-random functions if the receiver can do more than xors. ( I doubt it is secure...). Initially, expand $K$ into $K_1, K_2, K_3$ of appropriate length.
The sender does the following
- $r =$ AES-CTR$(K_1, counter)$ (keep last 48 bits)
- send $counter, r, \tau = HMAC(K_2, counter,r)$
The receiver does the following
- Upon receiving $r, \tau$, verify $\tau$
- Check counter has increased
- Rederive $r$.
Some remarks:
- Broadcasting here is not even necessary if the sender and receiver are someone sharing a clock.
- The alternative has a few problems when it comes to robustness in case of a reboot, as pointed out in a comment by Paul.