ã³ã³ãã¥ãŒã¿ãŒã¯ã©ãã®ã¹ããã¡ãŒ/ FireWall /ãã¢ã¬ã³ã¿ã«ã³ã³ãããŒã«/ SpyWare /ã¯ã©ã€ã¢ã³ããäœæããŸãã LSPãã¯ãããžãŒ
ãããã€ããŒïŒã
æè¿ãç§ã®å人ããã³ã³ãã¥ãŒã¿ãžã®ã¢ã¯ã»ã¹ãå¶åŸ¡ããèªåçã«èª°ãšãªããæ€èšããããã°ã©ã ã§ããé»åã«ãŒã ïŒã©ã€ãã©ãªïŒã«å¿ èŠãªæ¬²æ±ãæããã«ããŸããã
2012幎ã®äºç®ã«ãéããªãã£ããããå人ãé»è©±ãåããŸããã ããããã¢ã¯ã»ã¹å¶åŸ¡ã®ã¢ã€ãã¢ã¯ãã§ã«çºç«ããŠããŸãã ç§ã¯ãããã©ããããèãå§ããŸããã
ãšãããã1ã€ã®è³ªåãç§ãæ©ãŸããŸããã ãŠãŒã¶ãŒãã³ã³ãã¥ãŒã¿ãŒãã¬ã³ã¿ã«ããããã ãã«æ¯æããã€ã³ã¿ãŒãããã䜿çšããŠã³ã³ãã¥ãŒã¿ãŒãåããå Žåã«HTTPãã©ãã£ãã¯ããããã¯ããæ¹æ³ã¯ïŒ
ã€ã³ã¿ãŒãããã§LSPã«ã€ããŠã®èå³æ·±ãèšäºãèŠã€ããŸããããä»åºŠã¯ããã€ãã®å€æŽãå ãã翻蚳ã玹ä»ããŸãã
誰ã«ãããé¢çœããç§ã¯ãã£ããã®äžã§ãé¡ãããŸãã
LSPããŒã¹ã®HTTPã¹ããã¡ãŒïŒã¬ã€ã€ãŒããµãŒãã¹ãããã€ããŒïŒ
ãã®èšäºã§ã¯ãWindowsã§HTTPãã©ãã£ãã¯ãç£èŠããç°¡åãªã¹ããã¡ãŒãäœæããæ¹æ³ã«ã€ããŠèª¬æããŸãã ãã®ããã°ã©ã ã¯ãMicrosoftãæäŸãããªãŒãã³ãã¯ãããžãŒã«åºã¥ããŠããããã®ååã¯LSPïŒLayered Service ProviderïŒã§ãã
ãã®æè¡ã¯ãããŸããŸãªãœãããŠã§ã¢ã§äœ¿çšãããŠããŸãã ãããã¯ãäž»ã«ã¢ã³ããŠã€ã«ã¹ããã¡ã€ã¢ãŠã©ãŒã«ãããã³ãã©ãã£ãã¯ãã£ã«ã¿ãªã³ã°ããã°ã©ã ã§ãã
ãã®ãœãããŠã§ã¢ããã±ãŒãžãäœæããããã«ãMicrosoft Platform SDKã®ãµã³ãã«ïŒProgram Files \ Microsoft Platform SDK \ Samples \ NetDS \ WinSock \ LSP \ïŒã䜿çšããHTTPãã©ãã£ãã¯ããã£ã«ã¿ãŒåŠçããŠå¥ã®ã¹ãã¬ãŒãžã«çµæãåéããæ©èœãè¿œå ããŸããã
ã³ã³ã»ãã
åºæ¬ã¹ããŒã
å§ãã
çµè«ãšãã³ã
䟿å©ãªãªã³ã¯ã
ã³ã³ã»ããã
LSPã®äž»ãªã¢ã€ãã¢ã¯ãæ¢åã®ãããã€ããŒã®ãã§ãŒã³ã«å«ãŸãããããã€ããŒãäœæããããšã§ãã äœããWindowsã®ããã¯ã®åçãæãèµ·ããããŸãã
ãããã€ããŒã®ã€ã³ã¹ããŒã«äžã«ããããã€ããŒã®ãã§ãŒã³å ã®å Žæãæå®ã§ããŸãã ãããŠãæ°ããèšå®ã«åŸã£ãŠãã§ãŒã³ãåæ§ç¯ãããŸãã ãã®å Žåããããã€ããŒã¯[TCP / IP]ãããã€ããŒã®äžã«ã€ã³ã¹ããŒã«ãããŸãã å®éã®ãã·ã³ã«ã€ã³ã¹ããŒã«ãããšãã¯æ³šæããŠãã ããã ã€ã³ã¹ããŒã«ã«å€±æãããšããããã¯ãŒã¯ãã€ã³ã¿ãŒããããäžéšã®ãããã¯ãŒã¯ã¢ããªã±ãŒã·ã§ã³ã®æ倱ãªã©ãå€ãã®åé¡ãè¿œå ãããŸãã
åé¡ã®ãããã°ãšLSPãããã€ããŒã®äœæãåé¿ããã«ã¯ãä»®æ³ãã·ã³ã§ãã¹ãããŸãã
LSPãããã€ããŒã§ã¯ããã¹ãŠã®winsockã©ã€ãã©ãªã¡ãœããã眮ãæããå¿ èŠããããŸãã å®éãPlatform SDKã®äŸã§ã¯ã眮æããžãã¯ããã§ã«å«ãŸããŠãããã€ã³ã¿ãŒã»ãããURLãããã¯ããŸãã¯HTTPãã©ãã£ãã¯ã®ä¿åã®ããžãã¯ãè¿œå ããããã«ã®ã¿æ®ããŸãã
LSPã¯ãæ³çããã°ã©ã ãšSpyWare / AdWareã®äž¡æ¹ã䜿çšããŸãã
äŸïŒ
æ³çããã°ã©ã ïŒ
- Sygateãã¡ã€ã¢ãŠã©ãŒã«
- McafeeããŒãœãã«ãã¡ã€ã¢ãŠã©ãŒã«
- E-safe
- Dr.Web Security Space 6ã¯ããã¢ã¬ã³ã¿ã«ã³ã³ãããŒã«ã¢ãžã¥ãŒã«ãšããŠLSPã䜿çšããŸãã
ã¢ããŠã§ã¢ïŒ
- Webhancer
- New.net
- ãã¥ãŒãããããã
åäœäžã®LSPã
åºæ¬ã¹ããŒã
ããã¯ããœãããŠã§ã¢ããã±ãŒãžã®åºæ¬çãªã¹ããŒã ã§ãã
ãœãããŠã§ã¢ããã±ãŒãžã®ã€ã³ã¹ããŒã«åŸãå€ãã®ããã°ã©ã ããããã€ããŒã䜿çšããŸãïŒäžè¬çã«ããããã€ããŒã¯Winsockã©ã€ãã©ãªã䜿çšãããã¹ãŠã®ã¢ããªã±ãŒã·ã§ã³ã«ããŒããããåçŽãªDLLãã¡ã€ã«ã§ãïŒã ãã ããå¿ èŠãªã®ã¯HTTPãã©ãã£ãã¯ã®ã¿ã§ãã 以äžã¯ãç£èŠå¯Ÿè±¡ã®ããŒãããŠã³ãããŒããåããïŒç§ãã¡ã®ãããã€ããŒã®ïŒã³ãŒãè¡ã§ãïŒHTTPãããã³ã«ã¯ããã©ã«ãã§ããŒã80ã䜿çšããŸãïŒã
if((namelen >= sizeof(sockaddr_in)) && (((sockaddr_in*)name)->sin_port == htons(HTTPPort))) { SocketContext->intercept = TRUE; }
ãã®ããŒã«ãæ¹åããäŸã®ããã«ããŒãå®çŸ©ãããå®æ°ã§ã¯ãªããããã°ã©ã ããžãã¯ããããšã¬ã¬ã³ãã«ããŠèšå®ãä¿åã§ããŸãã
ããã«ãHTTPèŠæ±ãå®çŸ©ããå¿ èŠããããŸãã HTTP GETãªã¯ãšã¹ãã¯ãæååãGETããšã®åçŽãªæ¯èŒã«ãã£ãŠæ±ºå®ãããŸãã POSTãªã¯ãšã¹ãã®å®çŸ©ãåãæ¹æ³ã§è¡ããŸãã
ãŸãããã£ã«ã¿ãŒããããã¹ãŠã®æ å ±ãåéãããµãŒãã¹ããããŸãããµãŒãã¹ã¯ããŒã¿ç Žæãé²ãããã«äœæããããã®ã§ã1ã€ã§ã¯ãªãè€æ°ã®ã¢ããªã±ãŒã·ã§ã³ãç£èŠããå Žåã«çºçããå¯èœæ§ããããŸãã ãã©ãŠã¶ããååããããã¹ãŠã®æ å ±ã¯ããã®ãµãŒãã¹ã«éä¿¡ãããŸãã ãã®ãµãŒãã¹ã¯SocketãµãŒããŒïŒããŒã4004ã§ãªã¹ãã³ã°ïŒã§ãããããããŒã¿åéã®åæã«åé¡ã¯ãããŸããã ãã®å ŽåãããŒã¿ãŠã§ã¢ããŠã¹ã¯åãªãããã¹ããã¡ã€ã«ã§ããããã䟿å©ã§å®å®ãããªãã·ã§ã³ã«ç°¡åã«çœ®ãæããããšãã§ããŸãïŒããšãã°ãDBMSã䜿çšïŒã
å§ãã
ãã¹ãããã±ãŒãžã«ã¯ã次ã®ãããžã§ã¯ããå«ãŸããŠããŸãã
1.LSPãããžã§ã¯ãïŒLSPãã©ã«ããŒïŒ
ãã®ãããžã§ã¯ãã«ã¯ãåºæ¬çãªWinsockã¡ãœããã®ãªãŒããŒããŒããå«ãŸããŠããŸãã ãã®å Žæã§å€æŽãè¿œå ããå¿ èŠããããŸãã ç§ã®å Žåããã®ãããžã§ã¯ãã«ã¯Platform SDKã®ãµã³ãã«ãå«ãŸããŠããã80çªç®ã®ããŒããžã®æ¥ç¶ã決å®ããããžãã¯ãè¿œå ããConnectã¡ãœããã§ã€ã³ã¿ãŒã»ãããããŠãããšããŒã¯ããŸããã
if((namelen >= sizeof(sockaddr_in)) && (((sockaddr_in*)name)->sin_port == htons(HTTPPort))) { SocketContext->intercept = TRUE; }
ãããã£ãŠãSendã¡ãœããã®ä»åŸã®åŒã³åºãã§ã¯ããã®ãœã±ãããHTTPãããã³ã«ã«ãã£ãŠäœ¿çšãããããšãããããŸãã ãŸããConnectã¡ãœããã§ãã©ãã£ãã¯åéãµãŒãã¹ãžã®æ¥ç¶ã確ç«ããŸããã SENDã¡ãœããã§ã¯ãHTTPèŠæ±ãæ€åºãããããããµãŒãã¹ã«ãªãã€ã¬ã¯ãããããžãã¯ãå®è£ ããŸããã
if (IsHTTPRequest(lpBuffers->buf) && SocketContext->intercept) { SetBlockingProvider(SocketContext->Provider); ret = SocketContext->Provider->NextProcTable.lpWSPSend( serviceConnection.GetSocket(), lpBuffers, dwBufferCount, lpNumberOfBytesSent, dwFlags, lpOverlapped, lpCompletionRoutine, lpThreadId, lpErrno ); SetBlockingProvider(NULL); }
èªã¿èŸŒãŸããDLLãã¡ã€ã«ããšã«1ã€ã®æ°žç¶çãªæ¥ç¶ãä¿æããç¹æ®ãªã¯ã©ã¹ãäœæããŸããã
class ServiceConnectionKeeper;
ãã®åœ¹å²ã¯ããœã±ããã®æ¥ç¶ãç¶æããããšã§ãã ãããã£ãŠãã¹ãã¬ãŒãžãµãŒãã¹ãšã®æ¥ç¶ã¯1ã€ã ã確ç«ãããŸãã
2.å ±éãããžã§ã¯ãïŒå ±éãã©ã«ããŒïŒ-ãã®ãããžã§ã¯ãã«ã¯ãPlatform SDKã®äŸã§æäŸãããŠãããã¹ãŠã®ãŠãŒãã£ãªãã£ãå«ãŸããŠããŸãã ãŸããLSPãããã€ããŒããã®GUIDæäœãè¡ãããŸããã
ã€ã³ã¹ããŒã©ãŒãããžã§ã¯ãïŒInstallerãã©ã«ããŒïŒã¯LSPã€ã³ã¹ããŒã©ãŒã§ãã ã¡ã€ã³ã¡ãœãããå€æŽããŸãã-ã³ãã³ãã©ã€ã³è§£æãåé€ããTCPãããã€ããŒã®æ€çŽ¢ãè¿œå ããŸããã ããã§ãã€ã³ã¹ããŒã«äžã«TCPãããã€ããŒIDãæ¢ãããããã€ããŒãã§ãŒã³ãåæ§ç¯ããŸãã ãããã€ããŒãTCPã®äžã«é 眮ããŸããã
if (IsHTTPRequest(lpBuffers->buf) && SocketContext->intercept) { SetBlockingProvider(SocketContext->Provider); ret = SocketContext->Provider->NextProcTable.lpWSPSend( serviceConnection.GetSocket(), lpBuffers, dwBufferCount, lpNumberOfBytesSent, dwFlags, lpOverlapped, lpCompletionRoutine, lpThreadId, lpErrno ); SetBlockingProvider(NULL); }
3. Serviceãããžã§ã¯ãïŒServiceãã©ã«ããŒïŒã¯ãã©ãã£ãã¯ã³ã¬ã¯ã¿ãŒã§ãã ããã¯åçŽãªWindowsãµãŒãã¹ã§ããããµãŒãã¹ãã€ã³ã¹ããŒã«ããã³ã¢ã³ã€ã³ã¹ããŒã«ããæ¹æ³ã§ãã ãã®ãµãŒãã¹ã®MAINæ©èœã¯ãSocketãµãŒããŒãå®è£ ããŠããŸãã ãµãŒãã¹ãæäœãããã¹ãŠã®ããžãã¯ã¯ãMSDNãã芪åã«åããŠããŸãã ãµãŒããŒã¯ãã¹ãŠã®çä¿¡æ¥ç¶ãåãå ¥ããã¢ããªã±ãŒã·ã§ã³ããšã«åå¥ã®ã¹ã¬ãããèµ·åããŸãã èµ·åãããã¹ããªãŒã ã¯ãã\ r \ n \ r \ nãïŒåºæ¬çã«ã¯2ã€ã®ç©ºè¡ïŒã§åºåãããããŒã¿ãé çªã«åä¿¡ããã¹ãã¬ãŒãžã«ä¿åããŸãã
do { result = recv(clientSocket, buffer, PACKSIZE, 0); if (result > 0) { response += std::string(buffer, result); do { position = response.find(messageTerminator); if (std::string::npos != position) { if (!CollectorServer::Instance()->SaveData(std::string(response.begin(), response.begin() + position))) { return -1; } response = response.substr(position + messageTerminator.size()); } } while (std::string::npos != position); } else { break; } } while (SOCKET_ERROR != result);
ãã®ãããžã§ã¯ãã§ã®äœæ¥ãéå§ããã«ã¯ãVisual Studioãããžã§ã¯ãå šäœãçµã¿ç«ãŠãå¿ èŠããããŸãã ãã®åŸãNSIã¹ã¯ãªããããã«ãçµæãã©ã«ããŒã«å ¥ããŠãNsiã¹ã¯ãªãããã³ã³ãã€ã«ããŸãã ã€ã³ã¹ããŒã«setup.exeãã¡ã€ã«ãååŸããŸã
setup.exeã®ã€ã³ã¹ããŒã«äžã«ãå¿ èŠãªãã¹ãŠã®ãã¡ã€ã«ãäœæ¥ãã©ã«ããŒã«è§£åãããŸãã LSP.DLLã¯ïŒ SYSTEMROOTïŒ \\ system32 \\ LSP.dllã«é 眮ãããŸãã ãµãŒãã¹ãšãããã€ããŒã®ã€ã³ã¹ããŒã©ãŒã¯Program Filesãã©ã«ããŒã«é 眮ãããŸãã ãŸããã¢ã³ã€ã³ã¹ããŒã«ã·ã§ãŒãã«ããã¯ãã¹ã¯ãããã«é 眮ãããŸãã å±¥æŽãã¡ã€ã«ã¯CïŒ//ã®ã«ãŒãã«é 眮ãããŸãã
çµè«ãšã¢ããã€ã¹ã
ãã®èšäºã§ã¯ãç¬èªã®ãããã€ããŒãäœæãããã¹ãŠã®ãããã¯ãŒã¯ãã©ãã£ãã¯ãç£èŠããæ¹æ³ã«ã€ããŠèª¬æããŸãã ããããããã¯ãã®æè¡ã䜿çšããå¯äžã®äŸã§ã¯ãããŸããã 次ã®ããžãã¯ãç°¡åã«å®è£ ããããšãã§ããŸãã
HTTPèŠæ±ãšå¿çããããã¯ããŸãã
ãã©ãã£ãã¯ã®å€æŽãšåé€ã
æ¥ç¶ããããã¯ããŸãïŒãã¡ã€ã¢ãŠã©ãŒã«ãšåæ§ïŒã
SLLæå·åããŒã¿ã®ã€ã³ã¿ãŒã»ããïŒMITMã€ã³ã¿ãŒã»ãããå®è¡ããããšãå¯èœã§ãïŒïŒããã«ã®ç·ïŒ
ã€ã³ã¿ãŒãããæ¥ç¶ã倱ãããé害ãçºçããããšãåŸæããªãããã«ãLSPã®éçºã«ã¯å€ãã®ã¬ãŒãããããŸããããã¹ãã«ã¯ä»®æ³ãã·ã³ã䜿çšããããšããå§ãããŸãã æ¯åWindowså埩ã·ã¹ãã ã䜿çšããããããVMã€ã¡ãŒãžã以åã®ç¶æ ã«ããŒã«ããã¯ããæ¹ãã¯ããã«äŸ¿å©ã§ãã
ã»ãšãã©ã®ãŠã€ã«ã¹å¯ŸçãœãããŠã§ã¢ããã®ãã¯ãããžãŒã䜿çšããŠãããããOSã«ã€ã³ã¹ããŒã«ãããŠããLSPãããã€ããŒã®ãã§ãŒã³ã§ããããèŠã€ããããšãã§ããŸãã ãŸããã¢ã³ããŠã€ã«ã¹ã¯ãã©ãã£ãã¯ããã£ã«ã¿ãªã³ã°ãããããLSPãããã€ããŒããã¹ããããšãã«ã¢ã³ããŠã€ã«ã¹ãåé¡ã«ãªãå¯èœæ§ããããŸãã
éžæããã¢ããªã±ãŒã·ã§ã³ãç¡èŠããããžãã¯ãè¿œå ã§ããŸãã ãã®ãããã¢ããªã±ãŒã·ã§ã³ãç¡èŠãªã¹ãã«ããå ŽåãLSPãããã€ããŒã¯ããŒã¿ã®è»¢é以å€ã¯äœãããŸããã
ãã®ããŒã«ã¯ã32ãããã¢ããªã±ãŒã·ã§ã³å°çšã«éçºãããŸããã ãã ãã64ãããã¢ããªã±ãŒã·ã§ã³ã«ç°¡åã«ç§»æ€ã§ããŸãã ãããžã§ã¯ãã64ãããã«åæ§ç¯ãããããã€ããŒã®ã€ã³ã¹ããŒã«äžã«LspCatalog64Onlyãã©ã°ãèšå®ããã ãã§ãã
ãã®ããŒã«ãäœæããããã«è¡ãããPlatform SDKã®äŸã®å€æŽã確èªããã«ã¯ãããã¹ããå ã®äŸãšæ¯èŒã§ããŸãã
ãŸããã³ã¡ã³ã//è¿œå ã«ãã£ãŠè¿œå ããããã¹ãŠã®ã³ãŒããããã¯ã«æ³šæããŸãã
ãŸããä»ã®LSPãããã€ããŒãšã®ç«¶åãé¿ããããã«ãLSPãããã€ããŒã®æ°ããGUIDãçæããå¿ èŠãããããšã«æ³šæããŠãã ããã
䟿å©ãªãªã³ã¯
æ®å¿µãªãããå€ãã®ãªã³ã¯ã¯ãããŸãããããããã¯ãŸã ããã«ãããŸãã
0. è±èªã®ãªãªãžãã«èšäº
1. MSDNããã³Platform SDKã®ããã¥ã¡ã³ãã
2. LSPéçºè ã®Webãµã€ãã«ãæ å ±ããããŸã ã
ãããžã§ã¯ãèªäœã¯ããã«ã¬ã€ã¢ãŠããããŠããŸã
ãŸãããããžã§ã¯ãã¯GITHABã«æçš¿ãããŠããŸã