Repository navigation
Description
Hi there. I had been holding off on updating since 0.43.4, because the changes after that version broke something on my system. Now that I have some time, I looked into it more closely and ran into the following issue. Please note that this report is based only on logs and tcpdump captures. I have not yet checked the onvif sources in lightnvr, so my analysis is a hypothesis that I haven’t validated against the code.
Summary
ONVIF PullPoint event subscriptions fail on TP-Link Tapo cameras (tested on Tapo C545D, the initial dual-lens camera for LightNVR's dual-lens ONVIF event implementation) in v0.48.2.
While CreatePullPointSubscription succeeds against port 2020, the camera returns a SubscriptionReference (wsa5:Address) on a dynamically allocated ephemeral port on the exact same host IP (e.g., :1026). LightNVR's origin validation rejects this endpoint because the port does not match the configured ONVIF base URL port (2020), completely breaking ONVIF motion detection and dual-lens cross-triggering.
Environment
- LightNVR Version:
v0.48.2(previously working in0.43.4before strict port origin validation) - Architecture / Host: ARM64 (
aarch64, Radxa Rock 4C+, Debian Trixie / Docker) - Camera Model: TP-Link Tapo C545D (Dual-Lens PTZ, reference hardware for dual-lens ONVIF event setup)
- Configured ONVIF URL:
http://192.168.1.123:2020/
Evidence
1. LightNVR Log Output
LightNVR successfully authenticates and creates the subscription, then immediately drops the returned PullPoint endpoint:
[INFO] Successfully created ONVIF subscription (lease: 600 seconds)
[WARN] Rejected ONVIF subscription endpoint outside the configured camera origin
[ERROR] Failed to pull messages from subscription
[WARN] [c545d_wide] ONVIF thread: detect_motion_onvif error -1 – backing off 5 s before retry
2. Packet Capture (tcpdump) of CreatePullPointSubscriptionResponse
Capturing the SOAP exchange between LightNVR and 192.168.1.123:2020 confirms that the Tapo C545D accepts CreatePullPointSubscription on :2020/onvif/event_service, but binds the subscription listener to a dynamic port (1026) on the same IP:
<SOAP-ENV:Header>
<wsa5:MessageID>urn:uuid:d9dfe7d4-b618-44c9-907e-b92785fbdcd0</wsa5:MessageID>
<wsa5:To SOAP-ENV:mustUnderstand="true">[http://192.168.1.123:2020/onvif/event_service](http://192.168.1.123:2020/onvif/event_service)</wsa5:To>
<wsa5:Action SOAP-ENV:mustUnderstand="true">[http://www.onvif.org/ver10/events/wsdl/EventPortType/CreatePullPointSubscriptionResponse](http://www.onvif.org/ver10/events/wsdl/EventPortType/CreatePullPointSubscriptionResponse)</wsa5:Action>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<tev:CreatePullPointSubscriptionResponse>
<tev:SubscriptionReference>
<wsa5:Address>[http://192.168.1.123:1026/event-1026_1026](http://192.168.1.123:1026/event-1026_1026)</wsa5:Address>
</tev:SubscriptionReference>
<wsnt:CurrentTime>2026-11-15T19:20:41Z</wsnt:CurrentTime>
<wsnt:TerminationTime>2026-11-15T19:30:41Z</wsnt:TerminationTime>
</tev:CreatePullPointSubscriptionResponse>
</SOAP-ENV:Body>
Root Cause Analysis
Origin Comparison Mismatch: The subscription endpoint validator enforces an exact match on (scheme, host, port) against the configured onvif_url (http://192.168.1.123:2020).
Device Behavior: TP-Link Tapo firmware assigns a dedicated dynamic port per PullPoint subscription (e.g., :1026, :1027, etc.) on the same device IP (192.168.1.123). Per the ONVIF Events / WS-BaseNotification specification, a SubscriptionReference endpoint is not required to share the same TCP port as the initial device/event service endpoint.
Proposed Fix
Keep strict SSRF protection on scheme (http/https) and host (exact IP/hostname match against the configured onvif_url), while allowing any valid TCP port (1..65535) on that same camera host (or making same-host port relaxation configurable).
Activity
RMG112096 commentedon Nov 16, 2026
Another affected camera: Mercusys MC500 (TP-Link's sister brand), ONVIF configured on port 2020.
I haven't upgraded past 0.45.3 yet precisely because of the origin check, so this is observed on 0.45.3 (which has no origin validation), not on 0.47+ / 0.48.x. What I saw with tcpdump and conntrack on the NVR host while the existing PullPoint subscription was being polled (every ~6 s):
So it looks like this camera also hands out a dynamic port on the same host IP for the subscription endpoint, the same behavior reported here for the Tapo C545D. This is inferred from the traffic pattern; I did not capture the SOAP CreatePullPointSubscriptionResponse itself, so I can't quote its wsa5:Address.
This supports the proposed fix: keep the scheme and host check, but allow any port on the same camera host (or make it configurable). Happy to test a fix on this camera if useful.
Environment
ghcr.io/opensensor/lightnvr:0.45.3, non-root, behind Caddy). Not tested on 0.47+ / 0.48.x; I'm holding on 0.45.3 because of this issue.http://192.168.0.53:2020/origin2000 commentedon Nov 19, 2026
@matteius Thanks for fixing this bug. I apologize that I have only posted the bug and not offered to fix it. I still was in research mode on ONVIF specs to understand whether this is a requirement of the standard and the proposal would break this requirement. Obviously the fix then would have become a "feature" that admins need to enable/disable and would have affected the code itself plus needed a GUI part. Any ways thanks for the effort and I'm looking forward to the next version.