Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Injection in ` \src\main\resources\mapper\NewBeeMallGoodsMapper.xml ` #1

LiGNG opened this issue Oct 19, 2019 · 1 comment


Copy link

@LiGNG LiGNG commented Oct 19, 2019


    <select id="findNewBeeMallGoodsListBySearch" parameterType="Map" resultMap="BaseResultMap">
        <include refid="Base_Column_List"/>
        from tb_newbee_mall_goods_info
            <if test="keyword!=null and keyword!=''">
                and (goods_name like CONCAT('%','${keyword}','%') or goods_intro like CONCAT('%','${keyword}','%'))
            <if test="goodsCategoryId!=null and goodsCategoryId!=''">
                and goods_category_id = #{goodsCategoryId}
        <if test="orderBy!=null and orderBy!=''">
                <when test="orderBy == 'new'">
                    <!-- 按照发布时间倒序排列 -->
                    order by goods_id desc
                <when test="orderBy == 'price'">
                    <!-- 按照售价从小到大排列 -->
                    order by selling_price asc
                    <!-- 默认按照库存数量从大到小排列 -->
                    order by stock_num desc
        <if test="start!=null and limit!=null">
            limit #{start},#{limit}

Where ${keyword} is used for splicing sql statements, there is a risk of SQL injection.


We will find a sql error, which proves that the vulnerability already exists.


This comment has been minimized.

Copy link

@ZHENFENG13 ZHENFENG13 commented Oct 23, 2019


@ZHENFENG13 ZHENFENG13 closed this Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.