Injection vulnerability in ExIRC.Client.msg() / IRC standard nonconformance

Đang mở
#97 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
elixir
Lĩnh vực
networking, security

Hướng nghiên cứu

Bắt đầu từ phần triển khai và các bài kiểm thử cho ExIRC.Client.msg(), được issue xác định là điểm vào dễ bị tấn công. Xác định cách các tin nhắn chứa ký tự xuống dòng được xử lý, sau đó xác minh rằng msg() từ chối chúng và hành vi được đề xuất của msg_multiline() gửi một tin nhắn IRC cho mỗi dòng. Issue không nêu tên các tệp hoặc bài kiểm thử cụ thể.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I'll present this as a little story:

Suppose we are implementing a bot that reads the titles from Web pages and posts them on IRC, a classic.

As a short introduction (only vaguely related to the bug), further suppose that we are using Floki (which is also not standards conformant) to parse the title of say, this webpage:

<!DOCTYPE html>
<html><head><title>I don&#39;t want to
quit programming!</title></head><body>
…</body></html>

(this is conformant HTML, even though the formatting isn't pretty!)

Assume the result gets into title = "I don't want to\nquit programming!"… and we get to the ExIRC bug:

ExIRC.Client.msg(state.client, :privmsg, dest, "Title: #{title}")

In the IRC channel we see:

<someone> https://domain.tld/blog/i-dont-want-to-quit-programming
<potionbot> Title: I don't want to
*potionbot has quit ("programming!")

Oops.

Obvious solutions:

  • Panicking: cut off all text after the first newline to prevent the injection.
  • Vengeful: throw an error if there is a newline in the message (this is not legal in the IRC standard anyway).
  • Posed: make the type of the fourth argument of ExIRC.Client.msg() a StringWithoutNewlines type, preventing the error at compile time.
  • Creative: post several messages in IRC, one per line.

My preference goes to the last two, and specifically both of them at once:

  • Make ExIRC.Client.msg() refuse newlines, preventing the application from starting if that's not guarded against, and
  • Introduce a new ExIRC.Client.msg_multiline() method that posts several messages to accomodate for the line feeds.

For more ideas, see https://eiv.dev

Ngôn ngữ chính
Elixir
Star
154
Fork
38
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bitwalker/exirc

Tất cả issue của bitwalker/exirc

Issue tương tự

Thêm issue về Elixir

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.