的WebRTC。服务器或其他对等方是否看到我的内部IP地址?

问题描述 投票:-1回答:1

是否可以通过浏览器中的WebRTC获取用户内部IP地址。在这里browserleaks webrtc我可以看到我的本地IP地址,但这个地址是通过JS脚本在客户端提取的。这里是最小的JS示例如何实现这一点

window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;   //compatibility for firefox and chrome
    var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){};      
    pc.createDataChannel("");    //create a bogus data channel
    pc.createOffer(pc.setLocalDescription.bind(pc), noop);    // create offer and set local description
    pc.onicecandidate = function(ice){  //listen for candidate events
        if(!ice || !ice.candidate || !ice.candidate.candidate)  return;
        var myIP = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1];
        document.querySelector('#output').innerHTML=myIP
        //console.log('my IP: ', myIP);   
        pc.onicecandidate = noop;
    };
    
<div id="output">

</div>

正如我们在代码中看到的,我们从onicecandidate事件中提取ip。

如果我们看一下WebRTC连接流,我们可以看到ICE候选者通过信号通道在对等体之间进行交换

那么STUN / TURN服务器可以获取内部IP地址的信息吗? (我怀疑这是可能的,但只是为了检查)

特制的对等客户端是否能够在连接阶段或与其他对等方交换ICE候选时获取另一个对等方的内部IP地址?

问题主要是关于安全问题

webrtc
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.