GPS time and position are trusted unless GPS_GUARD is enabled, and no variant enables it

未關閉
#3,977 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
c

研究方向

Start by tracing GpsGuard::acceptTime() and the GPS provider paths named in the issue: MicroNMEALocationProvider::updateTime() and RakLocationProvider. Check how build date, current fix, and GPS_GUARD_TIME_MAX_STEP affect time acceptance, then inspect the firmware variants to see how the guard is configured. Done means the default variants use the time checks while the position fence and speed checks remain opt-in, with relevant GPS tests or validation covering the behavior.

由索引模型根據 Issue 內容生成。

描述

GPS time and position are trusted without any sanity check unless GPS_GUARD is compiled in, and no variant enables it.

  • Time. After about four seconds of "valid" GGA/RMC sentences, MicroNMEALocationProvider::updateTime() sets the RTC to whatever the receiver reports, forwards or backwards (time_valid > 2), and again every 30 minutes. The RAK12500 path (RakLocationProvider) sets the clock from the first fix with a non-zero epoch and has no guard at all.
  • Position. Every valid fix replaces the last one, so the receiver alone decides the position that goes into adverts (when the location policy shares it) and into telemetry.

A wrong date doesn't need an attacker: GPS week-number rollover, or a cold start with a stale RTC. GNSS spoofing is cheap too. The clock matters more than the position here:

  • message and advert timestamps come from it;
  • a forward jump makes later messages from correctly clocked nodes look old;
  • servers keep a per-client last timestamp, so a backward step can lock clients out of logins until the clock catches up.

Suggestion: turn on GpsGuard's time checks by default. acceptTime() already refuses a GPS time before the firmware's build date, uses it only while a trusted fix is current, and limits a correction to GPS_GUARD_TIME_MAX_STEP (600 s) once the clock is valid. The position fence and speed checks can stay opt-in. #3972 adds range checks on the date fields themselves, but those only reject impossible dates, not wrong ones.

Turning the guard on doesn't hurt the common reboot case. A board without a battery-backed RTC restarts at VolatileRTCClock's fixed base time (15 May 2024). That is before any current build date, so the guard treats it as an unset clock and lets the first trusted fix set the real time in one step. The step limit only applies once the clock already holds a plausible time. Nodes with GPS turned off are unaffected either way.

Found while fuzzing the GPS code paths on the host (AI-assisted, Claude); checked by me.

主要語言
C
星號
3.9k
分支
1.5k
平均合併
2 天 19 小時
30 天內合併 PR
61

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

meshcore-dev/MeshCore 的其他 Issue

查看 meshcore-dev/MeshCore 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。