Forums: users (Thread #10266)

出来損ないのMIMEマルチパートヘッダのメッセージの扱い (2006-02-23 03:56 by a39 #20104)

bsfilterの仕様が空ろ覚えになってきているのですが,
確か文字コードについては MIME ヘッダを信用せず,コード判定した結果に基
づいて処理されていたように思います.

ここ1年程は,特に日本語の spam で,MIME マルチパート(でも実体はパー
トが1つしか存在しない)且つ,本文のパートが base64 エンコードされて,
Content-Transfer-Encoding: が 2つ記述された出来損ないの spam をよく見
かけるように思います.

具体的には

Content-Type: text/plain;
Content-Transfer-Encoding: base64
Content-Transfer-Encoding: 8bit

なんて具合になっている訳です.

このような場合,Mew では Charset = US-ASCII として base64 エンコード
されたデータのみが表示されています.(2つ目の Content-Transfer-Encoding
を削除するときちんとデコードされて表示されます.そもそも MIME Header
がおかしいので,Mew の振る舞いは無難なところかと思います)

debug オプションを使って bsfilter REVISION 1.77 を通した結果を見ると,
ヘッダのみ判定・学習の対象としていて,本文は全て捨てられていることが
判ります.
ヘッダのみでも,それなりの精度で判定できているのですが(これは以前から
ですね.評価結果は随分昔に報告してあると思います),本文の扱いについて
も何らかの措置を講じられると,判定能力の向上に繋がるかもしれないなと
思いました.

こんなものが増えてきているのですが,nabekenさんはどうしたら良いと
お考えでしょうか.
小生は Content-Transfer-Encoding で base64 と宣言しているものは,
base64 デコードを試みて,デコードできるようならコード判定の上,
spam 判定・学習を行えば良いように思うのですが.

Reply to #20104×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

訂正です(was 出来損ないのMIMEマルチパートヘッダのメッセージの扱い) (2006-02-23 04:15 by a39 #20105)

訂正です.

Mew で `|' コマンドを使って試してしまっていましたので,正確な bsfilter
の挙動ではありませんでした.
正確には bsfilter は base64 エンコードされたままのデータを tokenizer
が切り出し,spam の判定に使っていた模様です.

ex.

tokenizer C body Bk5DpjL6BSYFAid
tokenizer C body Ljo3Fi62CzIqukVOW
tokenizer C body s5e
tokenizer C body aC8ImeiYeC
tokenizer C body ie
tokenizer C body gZqDgYOLl0aCqpd
tokenizer C body grWCooGalOmWp4LMl
tokenizer C body aCqoK1gr2CooGa
tokenizer C body gqqPV4Kkiq6RU5azl7
tokenizer C body kWaQbI
tokenizer C body l7
tokenizer C body T
tokenizer C body I9YLMk4qNZYFAgZ
tokenizer C body Cooxug1SD
tokenizer C body oOBgVuDi4Kql4iC
tokenizer C body T

まぁ,確かに特定パターンが含まれる場合には,切り出される結果も同じに
なるでしょうから,それで誤判定が増えるということはないと思いますが,
一考の余地はあると思います.
Reply to #20104

Reply to #20105×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 出来損ないのMIMEマルチパートヘッダのメッセージの扱い (2006-02-26 00:18 by nabeken #20172)

"base64デコード出来るなら"という条件判断は難しいです。
Content-Transfer-Encodingが複数行あるのには対応可能です。
Content-Transfer-Encodingのいずれかの行でbase64といいつつ、実際にはplain textという事例はありますか?
Reply to #20104

Reply to #20172×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 出来損ないのMIMEマルチパートヘッダのメッセージの扱い (2006-02-27 02:18 by a39 #20196)

Content-Transfer-Encoding が base64 といいつつ,text/plain という例は
数が多くはないものの,皆無ではないと思います.(ちょっと洗い出しきれていません)

そもそも spammer が使う spamming tool 自体の完成度が低いので,
RFC が云々以前に一般的な MUA のメッセージを模倣しきれない低質な
spam が(特に日本語版には)多いように思います.

このいたちごっこに,どのような具合に立ち向かうかは,難しいなぁ...と
思っています.
Reply to #20172

Reply to #20196×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 出来損ないのMIMEマルチパートヘッダのメッセージの扱い (2006-02-28 00:15 by nabeken #20228)

r177_encoding ブランチで
- いずれかのContent-Transfer-Encodingヘッダにbase64とあり
- ボディの最初と最後の行がbase64 encodedっぽかったら
base64 decodeするようにしました。

Content-Transfer-Encodingヘッダが複数あるのはRFC違反でしょう。
Reply to #20196

Reply to #20228×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 出来損ないのMIMEマルチパートヘッダのメッセージの扱い (2006-03-01 20:16 by a39 #20302)

バッチリとデコードされて,中身の学習ができた模様です.
base64 encoded word を学習させるよりは,実用的かと思います.

MIME Header の RFC については,軽く洗ってみているのですが,定義とマルチパートにおける構造上の規程はありますが,特定パートにおける Content-transfer-encoding: (など)が単一でなければいけないという事は明示されていないような気がします.
通常は,単一指定なのですが,矛盾しない範囲で複数指定することを禁じている解釈が 関連しそうな RFC2045, RFC2231 などには見当たらないように思います.

# RFC って厳密に規程していない部分が多々ありますからねぇ...
Reply to #20228

Reply to #20302×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 出来損ないのMIMEマルチパートヘッダのメッセージの扱い (2006-03-02 21:48 by nabeken #20341)

RFC2045で以下のように定義されているので、この順番で最大1行と解釈しました。

entity-headers := [ content CRLF ]
[ encoding CRLF ]
[ id CRLF ]
[ description CRLF ]
*( MIME-extension-field CRLF )

MIME-extension-fieldにencodingも含むという考えもありますが、そうなると定義が冗長なように思います。
Reply to #20302

Reply to #20341×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 出来損ないのMIMEマルチパートヘッダのメッセージの扱い (2006-03-02 22:54 by a39 #20342)

わざわざ確認いただきありがとうございました.

MIME-extension-field は,section 10で将来の拡張用と断り書きがあるので,これに含むべきではないでしょう.
時間をかけて眺めないとダメですね.
Reply to #20341

Reply to #20342×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

複数行の Content-Transfer_Encoding (2006-02-27 02:12 by a39 #20195)

複数行の Content-Transfer-Encoding ってどう解釈すべきなのか,
きちんと調べておきたいところですね.

ちょっと RFC を調べているだけの余裕が... ;-)

小生が調べるなら,時間ください.
Reply to #20104

Reply to #20195×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login