promiscuous mode에서 읽은 지나가는 패킷을 어플리케이션까지 올릴 수 있나요?

jkmin96의 이미지

안녕하세요..

제 리서치와 관련해서 약간 해킹아닌 해킹 같은 것을 해야 하는데요. 절대 나쁜 목적을 가지고 하는 것은 아닙니다. 외국 포럼에서 경고 먹었습니다.ㅜ.ㅜ

상황은 이렇습니다.

|client| --------wireless--------|AP|--------Ethernet---------|server|

|monitor|

총 4개의 컴퓨터가 있는데요, 각각의 역할은 client, AP, server, 그리고 wireless traffic을 모니터 하는 monitor가 있습니다. monitor는 무선 인터페이스를 모니터 모드(promiscuos mode)를 사용하여 지나가는 패킷을 모두 받아들입니다.

client에서 iperf를 사용해서 udp traffic을 server로 보냅니다.

그 와중에 monitor가 client가 보내는 wireless 패킷들을 캠쳐하고, 본인도 Iperf를 사용하여 server랑 똑같이 udp traffic을 받기를 원합니다.

모니터를 테스트 하기 이전에, 세팅한 iptables rule (DNAT을 사용하여 destination address를 AP로 바꿔줌)이 잘 동작하나 확인하기 위해, AP에서 Iperf를 사용하여 서버로 가는 udp traffic을 대신 받아 봤는데 잘 동작했습니다.

같은 세팅으로 monitor에서 실행하면 (wireless interface에서 캡쳐된 udp 패킷들의 destination address 를 DNAT을 사용하여 monitor의 IP 주소로 바꿔줬습니다). 하지만 이경우에는 monitor의 Iperf로 인터페이스에서 캡쳐된 udp traffic이 올라오지 않는군요.

TCPDUMP를 사용하여 monitor의 무선 인터페이스에 client가 server로 보내는 udp traffic이 올라오는 것은 확인 했습니다. 문제는 인터페이스에서 받은 패킷이 iptables rule에 적용되기 전에 어디에선가 버려지는 것 같은데 그 부분이 어딘지, 어떻게 해결해야 패킷이 올라오게 할 수 있는 지를 잘 모르겠습니다.

조언 부탁드립니다. 급하게 해야 하는 일인데.. 해결책이 나오질 않네요..

감사합니다.

낄낄낄의 이미지

AP는 어차피 client의 GW가 됩니다. next hop 이죠. 그러니깐 자신한테 promisc로 설정 안해도 어차피 오게되는 패킷이라 이겁니다. 그래서 NAT 룰이 작동함

그럼 monitor는 어떠냐?
이건 말 그대로 promisc로 접근하여 모두 보긴합니다만, ip 스택으로 끌어올리면 드랍 시킵니다.
이유는 자신을 목적지로 온 패킷이 아니기 때문이죠.

아래 잘 보세요.
ip_rcv() {
..
/* When the interface is in promisc. mode, drop all the crap
* that it receives, do not try to analyse it.
*/
if (skb->pkt_type == PACKET_OTHERHOST)
goto drop;
..
}

정 바꿔보고 싶다면 커널 코드를 수정해서 pkt_type을 HOST로 바꾸던지요..

장담은 못해요 ㅋ

pak2536의 이미지

iptables 실행 전에 이미 드랍됩니다.

/*
* Main IP Receive routine.
*/
int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
{
struct iphdr *iph;
u32 len;

/* When the interface is in promisc. mode, drop all the crap
* that it receives, do not try to analyse it.
*/
if (skb->pkt_type == PACKET_OTHERHOST)
goto drop;

...

AP는 promisc 모드가 아니더라도 어차피 client의 gateway(next hop)이 되기 때문에 패킷 타입이 HOST가 되고, monitor는 자신을 목적으로 한 패킷이 아니기 때문에 위 처럼 드랍됩니다.

제 생각은 커널 코드 수정 ㄱㄱ

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.