UnvalidatedDynamicMethodCall query does not detect flow inside try/catch
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ệ
- express, javascript
- Lĩnh vực
- security
Hướng nghiên cứu
Bắt đầu với truy vấn UnvalidatedDynamicMethodCall và tái hiện challenge đào tạo được liên kết trong issue. So sánh route Express sử dụng req.params.action bên trong một trình xử lý arrow-function có và không có try/catch, sau đó xác nhận rằng lời gọi động dễ bị tấn công được phát hiện khi issue được sửa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi CodeQL team 👋
I'm currently building some training challenges for developers to help them identify insecure dynamic method calls. I designed one of the exercises based on the UnvalidatedDynamicMethodCall alert.
However, I noticed that the vulnerability I created was not detected by the query. After a lot of debugging, I suspect the query does not handle taint flow properly when the logic is inside arrow functions.
- The vulnerable code uses an Express route with an arrow function as the handler.
- Inside the arrow function, I access
req.params.actionand use it to dynamically invoke a method:userManager[action](...). - This allows access to both regular and admin-only methods of the userManager object.
Unfortunately, this pattern wasn't flagged by the query, even though it's clearly unsafe.
I'm still learning how CodeQL queries work, and I'm not very experienced with the query language yet. I'd really appreciate any help understanding why this scenario is missed, and how I might contribute a feature for it.
I'd love to open a PR — just need some guidance on how to proceed the right way.
update: I have tested here like @rvermeulen said and the catch is the try/catch.
git blaming cc: @asgerf
- Ngôn ngữ chính
- CodeQL
- Star
- 10.1k
- Fork
- 2.1k
- Merge trung bình
- 2 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 134
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/codeql
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
false-positive
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
false-positive
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Tất cả issue của github/codeql
Issue tương tự
-
Product: Azure Policy :shield: Topic: Diagnostic Settings :test_tube: Topic: Policy :pencil:
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
Azure/Azure-Landing-Zones#4283 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
MystenLabs/MemWal#979 · 1 bình luận ·
-
Claiming namespace [Tafanee] Đang mởnamespace operations
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
EclipseFdn/open-vsx.org#13384 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
documentation
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
inmanta/inmanta-core#10835 ·