├── .gitignore
├── .idea
├── dataSources.local.xml
├── dataSources.xml
├── inspectionProfiles
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── vcs.xml
├── workspace.xml
└── ywljsec.iml
├── LICENSE
├── README.md
├── apps
├── __init__.py
├── admin.py
├── apps.py
├── migrations
│ ├── 0001_initial.py
│ ├── 0002_auto_20220613_1400.py
│ ├── 0003_rename_price_userinfo_money.py
│ └── __init__.py
├── models.py
├── tests.py
└── views.py
├── document
├── README.md
├── img
│ ├── QQ22918914922917714320220615115816.gif
│ ├── QQ22918914922917714320220615115856.gif
│ ├── QQ22918914922917714320220615120259.gif
│ ├── QQ22918914922917714320220615120939.gif
│ ├── ezgif-3-53dc075be0.gif
│ ├── ezgif-3-a02d666c4a.gif
│ ├── ezgif-3-a403ac66ac.gif
│ ├── ezgif-3-ab2d06eda9.gif
│ ├── ezgif-3-fbd5d08174.gif
│ ├── ezgif-4-1631325bdb.gif
│ ├── ezgif-4-1f0d03d57b.gif
│ ├── ezgif-4-221d98cb88.gif
│ ├── ezgif-4-45f9e10b39.gif
│ ├── ezgif-4-597f7d528e.gif
│ ├── ezgif-4-6aa5629559.gif
│ ├── ezgif-4-7d657211fe.gif
│ ├── ezgif-4-7deaa41dca.gif
│ ├── ezgif-4-b94ab37b91.gif
│ ├── ezgif-4-c46452d12e.gif
│ ├── ezgif-4-cc7a05fbc1.gif
│ ├── image-20220615110331991.png
│ ├── image-20220615110752906.png
│ ├── image-20220615111337985.png
│ ├── image-20220615111409208.png
│ ├── image-20220615111541321.png
│ ├── image-20220615111831232.png
│ ├── image-20220615111850007.png
│ ├── image-20220615112627963.png
│ ├── image-20220615112827280.png
│ ├── image-20220615113025352-165528284295418.png
│ ├── image-20220615113025352.png
│ ├── image-20220615113118129.png
│ ├── image-20220615113218961.png
│ ├── image-20220615113317080.png
│ ├── image-20220615113432287.png
│ ├── image-20220615113449007.png
│ ├── image-20220615114211263.png
│ ├── image-20220615114302512.png
│ ├── image-20220615114517520.png
│ ├── image-20220615115439952.png
│ ├── image-20220615123834885.png
│ ├── image-20220615123841333.png
│ ├── image-20220615123854533.png
│ ├── image-20220615133523520.png
│ ├── image-20220615141723232.png
│ ├── image-20220615143103397.png
│ ├── image-20220615143135823.png
│ ├── image-20220615143213527.png
│ ├── image-20220615143344959.png
│ ├── image-20220615143358575.png
│ ├── image-20220615143923408.png
│ ├── image-20220615143933376.png
│ ├── image-20220615144325312.png
│ ├── image-20220615145630795.png
│ ├── image-20220615145646471.png
│ ├── image-20220615145704151.png
│ ├── image-20220615150305992.png
│ ├── image-20220615150315998.png
│ └── image-20220615150328086.png
├── 忘记密码
├── 支付.md
├── 注册.md
├── 越权.md
└── 验证码.md
├── manage.py
├── templates
├── index.html
└── shop.html
└── ywljsec
├── __init__.py
├── asgi.py
├── settings.py
├── urls.py
└── wsgi.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/.idea/dataSources.local.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | false
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/dataSources.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | sqlite.xerial
6 | true
7 | org.sqlite.JDBC
8 | jdbc:sqlite:C:\Users\lok\PycharmProjects\ywljsec\db.sqlite3
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | 1655088212747
92 |
93 |
94 | 1655088212747
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/.idea/ywljsec.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ywljsec
2 | 业务逻辑安全漏洞复现靶场
3 |
--------------------------------------------------------------------------------
/apps/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/apps/__init__.py
--------------------------------------------------------------------------------
/apps/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/apps/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class AppsConfig(AppConfig):
5 | default_auto_field = 'django.db.models.BigAutoField'
6 | name = 'apps'
7 |
--------------------------------------------------------------------------------
/apps/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.2.13 on 2022-06-13 03:01
2 |
3 | from django.db import migrations, models
4 |
5 |
6 | class Migration(migrations.Migration):
7 |
8 | initial = True
9 |
10 | dependencies = [
11 | ]
12 |
13 | operations = [
14 | migrations.CreateModel(
15 | name='userinfo',
16 | fields=[
17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18 | ('username', models.CharField(max_length=100)),
19 | ('password', models.CharField(max_length=100)),
20 | ('name', models.CharField(max_length=100)),
21 | ('phone', models.CharField(default='', max_length=100)),
22 | ('address', models.TextField(default='')),
23 | ('roles', models.CharField(default='', max_length=100)),
24 | ],
25 | ),
26 | ]
27 |
--------------------------------------------------------------------------------
/apps/migrations/0002_auto_20220613_1400.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.2.13 on 2022-06-13 06:00
2 |
3 | from django.db import migrations, models
4 |
5 |
6 | class Migration(migrations.Migration):
7 |
8 | dependencies = [
9 | ('apps', '0001_initial'),
10 | ]
11 |
12 | operations = [
13 | migrations.CreateModel(
14 | name='commodityinfo',
15 | fields=[
16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
17 | ('name', models.CharField(max_length=100)),
18 | ('price', models.FloatField()),
19 | ('limit', models.IntegerField()),
20 | ],
21 | ),
22 | migrations.CreateModel(
23 | name='orderinfo',
24 | fields=[
25 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
26 | ('username', models.CharField(max_length=100)),
27 | ('phone', models.CharField(max_length=100)),
28 | ('address', models.CharField(max_length=100)),
29 | ('ordererid', models.CharField(max_length=100)),
30 | ('purchase_amount', models.FloatField(max_length=100)),
31 | ('purchase_time', models.DateTimeField(auto_now=True)),
32 | ],
33 | ),
34 | migrations.AddField(
35 | model_name='userinfo',
36 | name='price',
37 | field=models.FloatField(default=500),
38 | ),
39 | ]
40 |
--------------------------------------------------------------------------------
/apps/migrations/0003_rename_price_userinfo_money.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.2.13 on 2022-06-13 06:17
2 |
3 | from django.db import migrations
4 |
5 |
6 | class Migration(migrations.Migration):
7 |
8 | dependencies = [
9 | ('apps', '0002_auto_20220613_1400'),
10 | ]
11 |
12 | operations = [
13 | migrations.RenameField(
14 | model_name='userinfo',
15 | old_name='price',
16 | new_name='money',
17 | ),
18 | ]
19 |
--------------------------------------------------------------------------------
/apps/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/apps/migrations/__init__.py
--------------------------------------------------------------------------------
/apps/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
5 |
6 |
7 | class userinfo(models.Model):
8 | username = models.CharField(max_length=100)
9 | password = models.CharField(max_length=100)
10 | name = models.CharField(max_length=100)
11 | phone = models.CharField(max_length=100,default='')
12 | address = models.TextField(default='')
13 | money = models.FloatField(default=50000)
14 | roles = models.CharField(max_length=100,default='普通用户')
15 |
16 |
17 | class commodityinfo(models.Model):
18 | name = models.CharField(max_length=100)
19 | price = models.FloatField()
20 | limit = models.IntegerField()
21 |
22 | class orderinfo(models.Model):
23 | username = models.CharField(max_length=100)
24 | phone = models.CharField(max_length=100)
25 | address =models.CharField(max_length=100)
26 | ordererid = models.CharField(max_length=100)
27 | purchase_amount = models.FloatField(max_length=100)
28 | purchase_time = models.DateTimeField(auto_now=True)
29 |
--------------------------------------------------------------------------------
/apps/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/apps/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render,HttpResponse
2 | from django.http import JsonResponse
3 | from .models import *
4 | from faker import Faker
5 | import random
6 | from django.views.decorators.csrf import csrf_exempt
7 | from django.core.cache import cache
8 |
9 |
10 | # Create your views here.
11 |
12 |
13 | # 首页
14 | def index(request):
15 | parallel_results = userinfo.objects.filter(roles='普通用户').values('username', 'password', 'name',
16 | 'phone', 'address', 'roles')
17 | parallelrs = []
18 | for i in parallel_results:
19 | parallelrs.append(i)
20 | parallel_users = random.choices(parallelrs,k=2)
21 | parallel_attack_user = parallel_users[0]['username']
22 | parallel_victim_user = parallel_users[1]['username']
23 |
24 | vertical_victim_user = userinfo.objects.filter(roles='管理员')[0].username
25 |
26 | return render(request,"index.html",locals())
27 |
28 | def unauthorized_access(request):
29 | if request.method =='GET':
30 | username = request.GET.get("username")
31 | role = request.GET.get("role")
32 | operation = request.GET.get("operation")
33 | password = request.GET.get("password")
34 | phone = request.GET.get("phone")
35 | address = request.GET.get("address")
36 | #未授权访问
37 | if username ==None:
38 | results = userinfo.objects.all().values('username','password','name','phone','address','roles')
39 | rs = []
40 | for i in results:
41 | rs.append(i)
42 | return JsonResponse(rs,safe=False)
43 | #平行越权
44 | elif len(username)>0 and role==None:
45 | #水平越权-查看用户信息
46 | if operation==None:
47 | results = userinfo.objects.filter(roles='普通用户').filter(username=username).values('username', 'password', 'name', 'phone', 'address', 'roles')
48 | rs = []
49 | for i in results:
50 | rs.append(i)
51 | return JsonResponse(rs,safe=False)
52 | #水平越权-修改用户信息
53 | elif operation =='edit':
54 | try:
55 | rs = userinfo.objects.get(username=username)
56 | if password!=None:
57 | rs.password=password
58 | if phone!=None:
59 | rs.phone=phone
60 | if address!=None:
61 | rs.address=address
62 | rs.save()
63 | return JsonResponse({"msg": "成功更新用户信息:" + username})
64 | except:
65 | return JsonResponse({"msg": "没有这条记录"})
66 | elif operation=='del':
67 | try:
68 | userinfo.objects.get(username=username).delete()
69 | return JsonResponse({"msg": "成功删除用户:"+username})
70 | except:
71 | return JsonResponse({"msg":"没有这条记录"})
72 | else:
73 | return JsonResponse({})
74 | #水平越权-删除用户信息
75 |
76 |
77 | #垂直越权
78 | elif len(username)>0 and role!=None:
79 | # 垂直越权-查看用户信息
80 | if operation == None:
81 | results = userinfo.objects.filter(roles=role).filter(username=username).values('username', 'password', 'name', 'phone', 'address', 'roles')
82 | rs = []
83 | for i in results:
84 | rs.append(i)
85 | return JsonResponse(rs, safe=False)
86 |
87 | #垂直越权-修改用户信息
88 | elif operation =='edit':
89 | try:
90 | rs = userinfo.objects.get(username=username)
91 | if password!=None:
92 | rs.password=password
93 | if phone!=None:
94 | rs.phone=phone
95 | if address!=None:
96 | rs.address=address
97 | rs.roles=role
98 | rs.save()
99 | return JsonResponse({"msg": "成功更新用户信息:" + username})
100 | except:
101 | return JsonResponse({"msg": "没有这条记录"})
102 | # 垂直越权-删除用户
103 | elif operation=='del':
104 | try:
105 | userinfo.objects.get(username=username).delete()
106 | return JsonResponse({"msg": "成功删除用户:"+username})
107 | except:
108 | return JsonResponse({"msg":"没有这条记录"})
109 | elif operation =='promotion':
110 | try:
111 | users = userinfo.objects.get(username=username)
112 | users.roles = role
113 | users.save()
114 | return JsonResponse({"msg": "更新成功:"+username})
115 | except:
116 | return JsonResponse({"msg":"没有这条记录"})
117 | else:
118 | return JsonResponse({})
119 | @csrf_exempt
120 | def shopping(request):
121 | if request.method =='GET':
122 | name = request.GET.get("name")
123 | username = request.GET.get("username")
124 | try:
125 | money = userinfo.objects.get(username=username).money
126 | except:
127 | return JsonResponse({"msg":"用户名不存在"})
128 | if name==None and username!=None:
129 | results = commodityinfo.objects.all().values('name', 'price', 'limit')
130 | rs = []
131 | for i in results:
132 | rs.append(i)
133 | return render(request,'shop.html',locals())
134 |
135 | elif request.method=='POST':
136 | username = request.GET.get("username")
137 | name = request.POST.get("name")
138 | price = request.POST.get("price")
139 | num = request.POST.get("num")
140 | userrs = userinfo.objects.get(username=username)
141 | money = userrs.money
142 | cmrs = commodityinfo.objects.get(name=name)
143 | limit = cmrs.limit
144 | if int(num)>limit:
145 | return JsonResponse({"msg":"超过商品限制"})
146 |
147 | total = int(num)*float(price)
148 | if total> money:
149 | return JsonResponse({"msg":"你的金额不够"})
150 |
151 | userrs.money = money-total
152 | userrs.save()
153 | cmrs.limit = limit-int(num)
154 | cmrs.save()
155 | return JsonResponse({"msg":"购买成功!!!"})
156 |
157 |
158 | #初始化数据
159 | def init_data(request):
160 | if request.method == 'GET':
161 | faker1 = Faker()
162 | faker2 = Faker("zh_CN")
163 | #用户数据初始化
164 | userinfo.objects.all().delete()
165 | roles = ['管理员','普通用户','客服人员']
166 | for i in range(0,1000):
167 | userinfo.objects.create(
168 | username=faker1.name(),
169 | password=faker2.password(),
170 | name=faker2.name(),
171 | phone=faker2.phone_number(),
172 | address=faker2.address(),
173 | roles=random.choice(roles)
174 | )
175 |
176 |
177 | #商品数据初始化
178 | commodityinfo.objects.all().delete()
179 | for i in range(0,10):
180 | commodityinfo.objects.create(
181 | name=faker1.city(),
182 | price = random.randint(1,100),
183 | limit = random.randint(1,100)
184 | )
185 |
186 | return HttpResponse("初始化成功")
187 |
188 | def msg_code(request):
189 |
190 | phone = request.GET.get("phone")
191 | attack_type = request.GET.get("attack_type")
192 | rcode = request.GET.get("code")
193 | code = random.randint(100000,999999)
194 | if attack_type == 'horizontal':
195 | cache.set(f'phone_{phone}', code,None)
196 | return JsonResponse({"msg":"手机号:"+phone+" 短信发送成功"})
197 |
198 | elif attack_type =='vertical':
199 | code_status = cache.get(f'phone_{phone}')
200 | if code_status==None:
201 | cache.set(f'phone_{phone}', code,60)
202 | return JsonResponse({"msg": "手机号:"+phone+" 短信发送成功"})
203 | else:
204 | return JsonResponse({"msg": "手机号:"+phone+" 需要等待一分钟才可以再次发送"})
205 |
206 | elif attack_type=='leak':
207 | return JsonResponse({"msg":"手机号:"+phone+" 短信发送成功","code":f"{code}"})
208 |
209 | elif attack_type=='nofail':
210 | code = cache.get(f'phone_{phone}')
211 | print()
212 | try:
213 | if int(rcode)==int(code):
214 | return JsonResponse({"msg":"短信验证码校验成功","code":200})
215 | else:
216 | return JsonResponse({"msg":"校验错误","code":0,"real_code":code})
217 | except:
218 | return JsonResponse({"msg":"请去获取短信验证码","code":200})
219 | elif attack_type=='noauth':
220 | code = cache.get(f'phone_{phone}')
221 |
222 | try:
223 | if rcode==None:
224 | return JsonResponse({"msg": "短信验证码校验成功", "code": 200})
225 |
226 | if rcode==code:
227 |
228 | return JsonResponse({"msg":"短信验证码校验成功","code":200})
229 | else:
230 | return JsonResponse({"msg":"校验错误","code":0,"real_code":code})
231 | except:
232 | return JsonResponse({"msg": "请去获取短信验证码", "code": 200})
233 |
234 | elif attack_type == 'constant':
235 |
236 | if rcode == '888888':
237 | return JsonResponse({"msg": "短信验证码校验成功", "code": 200})
238 |
239 | if rcode == code:
240 |
241 | return JsonResponse({"msg": "短信验证码校验成功", "code": 200})
242 | else:
243 | return JsonResponse({"msg": "校验错误", "code": 0, "real_code": code})
244 |
245 |
246 | return HttpResponse("")
247 | #cache.set('my_key', 'hello, world!', 30)
248 |
249 | def register(request):
250 | if request.method=='GET':
251 | attack_type = request.GET.get("attack_type")
252 | phone = request.GET.get("phone")
253 | username = request.GET.get("username")
254 | password = request.GET.get("password")
255 |
256 | if attack_type=='arbitrarily':
257 |
258 | try:
259 | ct = userinfo.objects.filter(phone=phone).count()
260 | if ct >0:
261 | return JsonResponse({"code":0,"msg":"该用户已经注册"})
262 | else:
263 | userinfo.objects.create(
264 | username=username,
265 | phone=phone,
266 | password=password,
267 | )
268 | return JsonResponse({"code": 200, "msg": "用户成功注册!!"})
269 | except Exception as e :
270 | userinfo.objects.create(
271 | username=username,
272 | phone=phone,
273 | password=password,
274 | )
275 |
276 |
277 |
278 | elif attack_type=='cover':
279 | userinfo.objects.create(
280 | username=username,
281 | phone=phone,
282 | password=password,
283 | )
284 | return JsonResponse({"code": 200, "msg": "用户成功注册!!"})
285 |
286 | elif attack_type=='cover_check':
287 | rs = userinfo.objects.filter(username=username).order_by("-id").values("id","username","phone","password")[0]
288 | return JsonResponse({"code": 200, "msg": rs})
289 |
290 |
291 | def order(request):
292 | if request.method=='GET':
293 | operation = request.GET.get("operation")
294 | username = request.GET.get("username")
295 | cname = request.GET.get("cname")
296 | userrs= userinfo.objects.get(username=username)
297 | money = userrs.money
298 | crs = commodityinfo.objects.get(name=cname)
299 | price = crs.price
300 | userrs.money = money-price
301 | userrs.save()
302 |
303 |
304 | if operation=='buy':
305 | pass
306 | elif operation == 'revoke':
307 | pass
--------------------------------------------------------------------------------
/document/README.md:
--------------------------------------------------------------------------------
1 | # 业务逻辑漏洞
2 |
3 | ## 简述
4 |
5 | 攻击者利用业务的设计缺陷,获取敏感信息或破坏业务的完整性, 其本质就是程序逻辑输入管控不严,**没有对用户数据进行严格把控**,导致程序不能够正常处理或处理错误。
6 |
7 |
8 |
9 | ## 越权漏洞
10 |
11 | **如果使用A用户的权限去操作B用户的数据,如果能够成功操作,则称之为越权操作**。 越权漏洞形成的原因是后台使用了不合理的权限校验规则导致的。一般越权漏洞容易出现在权限页面(需要登录的页面)增、删、改、查的的地方。
12 |
13 | 按照越权分类,可以分为**平行越权**和**垂直越权**。平行越权是指**同一权限下**,A用户可以操作B用户;垂直越权是指**不同权限下**,低权限A用户操作高权限B用户。
14 |
15 | **攻击场景:**
16 |
17 | - 水平越权-查看用户信息
18 | - 水平越权-修改用户信息
19 | - 水平越权-删除用户
20 | - 垂直越权-未授权访问
21 | - 垂直越权-查看管理员信息
22 | - 垂直越权-修改管理员信息
23 | - 垂直越权-删除管理员
24 | - 垂直越权-提升管理员
25 |
26 |
27 |
28 |
29 |
30 | ## 支付漏洞
31 |
32 | 电商类网站在业务流程整个环节,需要对业务数据的完整性和一致性进行保护,特别是确保在用户客户端与服务、业务系统接口之间的数据传输的一致性,通常在订购类交易流程中,容易出现服务器端未对用户提交的业务数据进行强制校验,过度信赖客户端提交的业务数据而导致的商品金额篡改漏洞。商品金额篡改测试,通过抓包修改业务流程中的交易金额等字段,例如在支付页面抓取请求中商品的金额字段,修改成任意数额的金额并提交,查看能否以修改后的金额数据完成业务流程。
33 |
34 |
35 |
36 | **攻击场景:**
37 |
38 | - 购买数量篡改
39 | - 付款金额篡改
40 |
41 |
42 |
43 | ## 验证码
44 |
45 | 验证码机制主要用于用户身份识别,常见可分为图片验证码、数字验证码、滑动验证码、短信验证码、邮箱验证码等。服务端未对验证码的验证时间、次数作出限制,存在**爆破**的可能性。
46 |
47 | **攻击场景:**
48 |
49 | - 短信验证码横向轰炸
50 | - 短信验证码纵向轰炸
51 | - 短信验证码泄露
52 | - 短信验证码不失效
53 | - 短信验证码绕过
54 | - 短信验证码写死
55 |
56 |
57 |
58 | ## 注册
59 |
60 |
61 |
62 | **攻击场景:**
63 |
64 | - 任意用户注册
65 | - 用户覆盖
66 |
--------------------------------------------------------------------------------
/document/img/QQ22918914922917714320220615115816.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/QQ22918914922917714320220615115816.gif
--------------------------------------------------------------------------------
/document/img/QQ22918914922917714320220615115856.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/QQ22918914922917714320220615115856.gif
--------------------------------------------------------------------------------
/document/img/QQ22918914922917714320220615120259.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/QQ22918914922917714320220615120259.gif
--------------------------------------------------------------------------------
/document/img/QQ22918914922917714320220615120939.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/QQ22918914922917714320220615120939.gif
--------------------------------------------------------------------------------
/document/img/ezgif-3-53dc075be0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-3-53dc075be0.gif
--------------------------------------------------------------------------------
/document/img/ezgif-3-a02d666c4a.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-3-a02d666c4a.gif
--------------------------------------------------------------------------------
/document/img/ezgif-3-a403ac66ac.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-3-a403ac66ac.gif
--------------------------------------------------------------------------------
/document/img/ezgif-3-ab2d06eda9.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-3-ab2d06eda9.gif
--------------------------------------------------------------------------------
/document/img/ezgif-3-fbd5d08174.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-3-fbd5d08174.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-1631325bdb.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-1631325bdb.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-1f0d03d57b.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-1f0d03d57b.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-221d98cb88.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-221d98cb88.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-45f9e10b39.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-45f9e10b39.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-597f7d528e.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-597f7d528e.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-6aa5629559.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-6aa5629559.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-7d657211fe.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-7d657211fe.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-7deaa41dca.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-7deaa41dca.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-b94ab37b91.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-b94ab37b91.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-c46452d12e.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-c46452d12e.gif
--------------------------------------------------------------------------------
/document/img/ezgif-4-cc7a05fbc1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/ezgif-4-cc7a05fbc1.gif
--------------------------------------------------------------------------------
/document/img/image-20220615110331991.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615110331991.png
--------------------------------------------------------------------------------
/document/img/image-20220615110752906.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615110752906.png
--------------------------------------------------------------------------------
/document/img/image-20220615111337985.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615111337985.png
--------------------------------------------------------------------------------
/document/img/image-20220615111409208.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615111409208.png
--------------------------------------------------------------------------------
/document/img/image-20220615111541321.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615111541321.png
--------------------------------------------------------------------------------
/document/img/image-20220615111831232.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615111831232.png
--------------------------------------------------------------------------------
/document/img/image-20220615111850007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615111850007.png
--------------------------------------------------------------------------------
/document/img/image-20220615112627963.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615112627963.png
--------------------------------------------------------------------------------
/document/img/image-20220615112827280.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615112827280.png
--------------------------------------------------------------------------------
/document/img/image-20220615113025352-165528284295418.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615113025352-165528284295418.png
--------------------------------------------------------------------------------
/document/img/image-20220615113025352.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615113025352.png
--------------------------------------------------------------------------------
/document/img/image-20220615113118129.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615113118129.png
--------------------------------------------------------------------------------
/document/img/image-20220615113218961.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615113218961.png
--------------------------------------------------------------------------------
/document/img/image-20220615113317080.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615113317080.png
--------------------------------------------------------------------------------
/document/img/image-20220615113432287.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615113432287.png
--------------------------------------------------------------------------------
/document/img/image-20220615113449007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615113449007.png
--------------------------------------------------------------------------------
/document/img/image-20220615114211263.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615114211263.png
--------------------------------------------------------------------------------
/document/img/image-20220615114302512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615114302512.png
--------------------------------------------------------------------------------
/document/img/image-20220615114517520.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615114517520.png
--------------------------------------------------------------------------------
/document/img/image-20220615115439952.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615115439952.png
--------------------------------------------------------------------------------
/document/img/image-20220615123834885.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615123834885.png
--------------------------------------------------------------------------------
/document/img/image-20220615123841333.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615123841333.png
--------------------------------------------------------------------------------
/document/img/image-20220615123854533.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615123854533.png
--------------------------------------------------------------------------------
/document/img/image-20220615133523520.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615133523520.png
--------------------------------------------------------------------------------
/document/img/image-20220615141723232.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615141723232.png
--------------------------------------------------------------------------------
/document/img/image-20220615143103397.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615143103397.png
--------------------------------------------------------------------------------
/document/img/image-20220615143135823.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615143135823.png
--------------------------------------------------------------------------------
/document/img/image-20220615143213527.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615143213527.png
--------------------------------------------------------------------------------
/document/img/image-20220615143344959.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615143344959.png
--------------------------------------------------------------------------------
/document/img/image-20220615143358575.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615143358575.png
--------------------------------------------------------------------------------
/document/img/image-20220615143923408.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615143923408.png
--------------------------------------------------------------------------------
/document/img/image-20220615143933376.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615143933376.png
--------------------------------------------------------------------------------
/document/img/image-20220615144325312.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615144325312.png
--------------------------------------------------------------------------------
/document/img/image-20220615145630795.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615145630795.png
--------------------------------------------------------------------------------
/document/img/image-20220615145646471.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615145646471.png
--------------------------------------------------------------------------------
/document/img/image-20220615145704151.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615145704151.png
--------------------------------------------------------------------------------
/document/img/image-20220615150305992.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615150305992.png
--------------------------------------------------------------------------------
/document/img/image-20220615150315998.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615150315998.png
--------------------------------------------------------------------------------
/document/img/image-20220615150328086.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/img/image-20220615150328086.png
--------------------------------------------------------------------------------
/document/忘记密码:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/document/忘记密码
--------------------------------------------------------------------------------
/document/支付.md:
--------------------------------------------------------------------------------
1 | # 支付漏洞
2 |
3 |
4 |
5 | ## 正常流程
6 |
7 | Sarah Bright用户,有余额500。
8 |
9 | 访问购买页面
10 |
11 | 
12 |
13 | 当购买商品数量超过限制会提示
14 |
15 | 
16 |
17 | 当不够钱的时候会提示
18 |
19 | 
20 |
21 | 购买成功,会看到数量和金额都相应减少。
22 |
23 | 
24 |
25 |
26 |
27 | ## 购买数量篡改
28 |
29 | 将商品数量修改为负数,即可负负得正,从而达到**加钱**效果。
30 |
31 | 
32 |
33 |
34 |
35 | ## 付款金额篡改
36 |
37 | `price`参数没有做校验, 可以传入负数,即可负负得正,从而达到**加钱**效果。
38 |
39 | 
--------------------------------------------------------------------------------
/document/注册.md:
--------------------------------------------------------------------------------
1 | # 注册
2 |
3 |
4 |
5 | ## 任意用户注册
6 |
7 | 漏洞URL:
8 |
9 | ```
10 | http://127.0.0.1:8000/register/?attack_type=arbitrarily&username=1234&phone=199999999&password=123
11 | ```
12 |
13 | `phone`参数存在漏洞,可以输入任意手机号即可成功注册用户
14 |
15 | 
16 |
17 | 
18 |
19 | 成功注册用户的提示。
20 |
21 | 
22 |
23 |
24 |
25 | 演示GIF:
26 |
27 | ![[video-to-gif output image]](img/ezgif-3-a02d666c4a.gif)
28 |
29 |
30 |
31 | ## 用户覆盖
32 |
33 | 用户注册功能没有严格校验已存在的用户账号,导致攻击者可以通过 重复注册其他用户账号的方式重置他人密码。
34 |
35 | 
36 |
37 |
38 |
39 | 
40 |
41 |
42 |
43 | 
44 |
45 | 演示GIF:
46 |
47 | ![[video-to-gif output image]](img/ezgif-3-ab2d06eda9.gif)
--------------------------------------------------------------------------------
/document/越权.md:
--------------------------------------------------------------------------------
1 | # 越权漏洞
2 |
3 | ## 水平越权
4 |
5 | `username`参数没有做校验导致产生平行越权漏洞,可以对正常用户的用户名进行信息收集后,输入正常用户名进行攻击。
6 |
7 | ### 查看用户信息(GET)
8 |
9 | 查看用户信息接口
10 |
11 | ```
12 | http://127.0.0.1:8000/unauthorized_access/?username=Taylor%20Velez
13 | ```
14 |
15 | 
16 |
17 | 找到一个受害者的username是`Jeffrey Jones`
18 |
19 | ```
20 | http://127.0.0.1:8000/unauthorized_access/?username=Jeffrey%20Jones
21 | ```
22 |
23 | 
24 |
25 | 演示GIF:
26 |
27 | ![[video-to-gif output image]](img/ezgif-4-b94ab37b91.gif)
28 |
29 | ### 修改用户信息(GET)
30 |
31 | 正常修改用户接口操作:
32 |
33 | ```
34 | http://127.0.0.1:8000/unauthorized_access/?username=Aaron%20Andrade&operation=edit&password=normal&phone=normal&address=normal
35 | ```
36 |
37 | 
38 |
39 | 正常用户修改成功信息返回
40 |
41 | 
42 |
43 | 攻击者发现漏洞,并且**修改密码、手机号、地址。**
44 |
45 | ```
46 | http://127.0.0.1:8000/unauthorized_access/?username=Aaron%20Andrade&operation=edit&password=hacker&phone=hacker&address=hacker
47 | ```
48 |
49 | 
50 |
51 | 演示GIF:
52 |
53 | ![[video-to-gif output image]](img/ezgif-4-45f9e10b39.gif)
54 |
55 |
56 |
57 | ### 删除用户(GET)
58 |
59 | 漏洞URL:
60 |
61 | ```
62 | http://127.0.0.1:8000/unauthorized_access/?username=Candice%20Whitaker&operation=del
63 | ```
64 |
65 | 
66 |
67 | 
68 |
69 | 演示GIF:
70 |
71 | ![[video-to-gif output image]](img/ezgif-4-1f0d03d57b.gif)
72 |
73 |
74 |
75 | ## 垂直越权
76 |
77 | `username`和`role`参数没有做校验导致产生平行越权漏洞,可以对正常用户的用户名进行信息收集后,输入正常用户名进行攻击。
78 |
79 | ### 未授权访问(GET)
80 |
81 | 漏洞URL接口:
82 |
83 | ```
84 | http://127.0.0.1:8000/unauthorized_access/
85 | ```
86 |
87 | 
88 |
89 | 演示GIF:
90 |
91 | ![[video-to-gif output image]](img/ezgif-4-1631325bdb.gif)
92 |
93 | ### 查看管理员信息(GET)
94 |
95 | 普通用户访问信息接口
96 |
97 | ```
98 | http://127.0.0.1:8000/unauthorized_access/?username=Eric%20Stark
99 | ```
100 |
101 | 
102 |
103 |
104 |
105 | 添加`role`参数的内容为`管理员`,即可查看到管理员信息
106 |
107 | ```
108 | http://127.0.0.1:8000/unauthorized_access/?username=Cassandra%20Wright&role=%E7%AE%A1%E7%90%86%E5%91%98
109 | ```
110 |
111 | 
112 |
113 | 演示GIF:
114 |
115 | ![[video-to-gif output image]](img/ezgif-4-7deaa41dca.gif)
116 |
117 |
118 |
119 | ### 修改管理员信息(GET)
120 |
121 | 普通用户修改信息
122 |
123 | ```
124 | http://127.0.0.1:8000/unauthorized_access/?username=Eric%20Stark&operation=edit&password=normal&phone=normal&address=normal&role=%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7
125 | ```
126 |
127 | 
128 |
129 | 攻击者修改管理员信息
130 |
131 | ```
132 | http://127.0.0.1:8000/unauthorized_access/?username=Linda%20Rios&operation=edit&password=hacker&phone=hacker&address=hacker&role=%E7%AE%A1%E7%90%86%E5%91%98
133 | ```
134 |
135 | 
136 |
137 | 修改成功
138 |
139 | 
140 |
141 | 演示GIF:
142 |
143 | ![[video-to-gif output image]](img/ezgif-4-c46452d12e.gif)
144 |
145 | ### 删除管理员(GET)
146 |
147 | 漏洞URL:
148 |
149 | ```
150 | http://127.0.0.1:8000/unauthorized_access/?username=Cassandra%20Wright&operation=del&role=%E7%AE%A1%E7%90%86%E5%91%98
151 | ```
152 |
153 | 
154 |
155 | 
156 |
157 | 演示GIF:
158 |
159 | ![[video-to-gif output image]](img/ezgif-4-221d98cb88.gif)
160 |
161 |
162 |
163 | ### 提升管理员(GET)
164 |
165 | Michael James为普通用户权限
166 |
167 | ```
168 | http://127.0.0.1:8000/unauthorized_access/?username=Michael%20James
169 | ```
170 |
171 | 
172 |
173 | 将他提升为**管理员权限**
174 |
175 | ```
176 | http://127.0.0.1:8000/unauthorized_access/?username=Michael%20James&operation=promotion&role=%E7%AE%A1%E7%90%86%E5%91%98
177 | ```
178 |
179 | 
180 |
181 | 查看是否提升成功。(需要添加role参数才可以查看)
182 |
183 | ```
184 | http://127.0.0.1:8000/unauthorized_access/?username=Michael%20James&role=%E7%AE%A1%E7%90%86%E5%91%98
185 | ```
186 |
187 | 
188 |
189 | 演示GIF:
190 |
191 | ![[video-to-gif output image]](https://im4.ezgif.com/tmp/ezgif-4-cc7a05fbc1.gif)
--------------------------------------------------------------------------------
/document/验证码.md:
--------------------------------------------------------------------------------
1 | # 验证码
2 |
3 |
4 |
5 | ## 短信验证码横向轰炸
6 |
7 | 对手机号123457发送短信
8 |
9 | ```
10 | http://127.0.0.1:8000/msg_code/?phone=123457&attack_type=horizontal
11 | ```
12 |
13 | 一直对该接口进行不断请求即可发送短信验证码。
14 |
15 | 
16 |
17 |
18 |
19 | **演示GIF:**
20 |
21 | 使用burp重放100次请求,都可以返回短信发送成功的信息。
22 |
23 | ![[video-to-gif output image]](img/ezgif-4-7d657211fe.gif)
24 |
25 | ## 短信验证码纵向轰炸
26 |
27 |
28 |
29 | ```
30 | http://127.0.0.1:8000/msg_code/?phone=123457&attack_type=vertical
31 | ```
32 |
33 | 
34 |
35 | 再次访问会提示需要一分钟才可以再次发送
36 |
37 | 
38 |
39 |
40 |
41 | 那我换成另外一个手机号即可再次发送
42 |
43 | 
44 |
45 | 演示GIF:
46 |
47 | ![[video-to-gif output image]](img/ezgif-4-597f7d528e.gif)
48 |
49 |
50 |
51 | ## 短信验证码泄露
52 |
53 | 漏洞URL:
54 |
55 | ```
56 | http://127.0.0.1:8000/msg_code/?phone=123457&attack_type=leak
57 | ```
58 |
59 | 后端会将短信验证码返回
60 |
61 | 
62 |
63 | ## 短信验证码不失效
64 |
65 |
66 |
67 | 短信验证码在**单位时间**或者**使用完成后**没有进行**销毁**,导致漏洞产生。常用于**暴力破解短信验证码**,伪造用户进去业务系统。
68 |
69 | 首先先获取短信验证码
70 |
71 | ```
72 | http://127.0.0.1:8000/msg_code/?phone=123457&attack_type=horizontal
73 | ```
74 |
75 | 
76 |
77 | 访问短信验证码校验接口,会提示报错
78 |
79 | ```
80 | http://127.0.0.1:8000/msg_code/?phone=123457&attack_type=nofail&code=438163
81 | ```
82 |
83 | 
84 |
85 | 然后将`real_code`参数的短信验证码替换`code`参数里面,即可验证成功。
86 |
87 | 
88 |
89 | 演示GIF:
90 |
91 | ![[video-to-gif output image]](img/ezgif-3-a403ac66ac.gif)
92 |
93 | ## 短信验证码绕过
94 |
95 | 开发没有对`code`参数进行类型校验,一旦`code`为空值就可以绕过流程。
96 |
97 | 漏洞URL:
98 |
99 | ```
100 | http://127.0.0.1:8000/msg_code/?phone=123457&attack_type=noauth&code=438163
101 | ```
102 |
103 | 
104 |
105 |
106 |
107 | 将`code`参数删掉,即可绕过校验
108 |
109 | 
110 |
111 |
112 |
113 | 演示GIF:
114 |
115 | ![[video-to-gif output image]](img/ezgif-3-fbd5d08174.gif)
116 |
117 |
118 |
119 | ## 短信验证码写死
120 |
121 | 测试人员在测试环境方便短信流程测试,会设置一个通用验证码,如123456、888888。这块校验流程也同步到生产环境,导致使用一个短信验证码即可访问所有用户账号。
122 |
123 | 随便输入一个短信验证码就会提示校验错误。
124 |
125 | 
126 |
127 | 这时候,对短信验证码已经爆破成功`888888`,可以看到该验证码对所有手机号是通用。
128 |
129 | 
130 |
131 | 
132 |
133 | 演示GIF:
134 |
135 | ![[video-to-gif output image]](img/ezgif-3-53dc075be0.gif)
136 |
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | """Run administrative tasks."""
9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ywljsec.settings')
10 | try:
11 | from django.core.management import execute_from_command_line
12 | except ImportError as exc:
13 | raise ImportError(
14 | "Couldn't import Django. Are you sure it's installed and "
15 | "available on your PYTHONPATH environment variable? Did you "
16 | "forget to activate a virtual environment?"
17 | ) from exc
18 | execute_from_command_line(sys.argv)
19 |
20 |
21 | if __name__ == '__main__':
22 | main()
23 |
--------------------------------------------------------------------------------
/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 业务逻辑安全漏洞复现
6 |
7 |
8 | 业务逻辑安全漏洞复现
9 | 初始化数据
10 | 越权
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 支付篡改
21 |
22 |
23 | 验证码
24 |
25 |
26 |
27 |
28 |
29 |
30 | 注册
31 |
32 |
33 | 密码重置
34 | 重放攻击
35 | 无限获利
36 | 条件竞争
37 |
38 |
39 |
--------------------------------------------------------------------------------
/templates/shop.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 购物商城
6 |
7 |
8 | 用户:{{ username }} 余额:{{ money }}
9 |
10 | {% for i in rs %}
11 | 商品名字:{{ i.name }} 商品价格:{{ i.price }} 商品限制:{{ i.limit }}
12 |
13 |
19 |
20 | {% endfor %}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ywljsec/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yingshang/ywljsec/ee848ff302b00888565aeb94ec4fe79894ce58e0/ywljsec/__init__.py
--------------------------------------------------------------------------------
/ywljsec/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for ywljsec project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ywljsec.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/ywljsec/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for ywljsec project.
3 |
4 | Generated by 'django-admin startproject' using Django 3.2.13.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.2/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/3.2/ref/settings/
11 | """
12 | import os
13 | from pathlib import Path
14 |
15 | # Build paths inside the project like this: BASE_DIR / 'subdir'.
16 | BASE_DIR = Path(__file__).resolve().parent.parent
17 |
18 |
19 | # Quick-start development settings - unsuitable for production
20 | # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
21 |
22 | # SECURITY WARNING: keep the secret key used in production secret!
23 | SECRET_KEY = 'django-insecure-p6*argwvuhp@-t)s!m@q57b^qc+p*-ve8bjd6h6fi_i%chbj!y'
24 |
25 | # SECURITY WARNING: don't run with debug turned on in production!
26 | DEBUG = True
27 |
28 | ALLOWED_HOSTS = ['*']
29 |
30 |
31 | # Application definition
32 |
33 | INSTALLED_APPS = [
34 | 'django.contrib.admin',
35 | 'django.contrib.auth',
36 | 'django.contrib.contenttypes',
37 | 'django.contrib.sessions',
38 | 'django.contrib.messages',
39 | 'django.contrib.staticfiles',
40 | 'apps.apps.AppsConfig',
41 | ]
42 |
43 | MIDDLEWARE = [
44 | 'django.middleware.security.SecurityMiddleware',
45 | 'django.contrib.sessions.middleware.SessionMiddleware',
46 | 'django.middleware.common.CommonMiddleware',
47 | 'django.middleware.csrf.CsrfViewMiddleware',
48 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
49 | 'django.contrib.messages.middleware.MessageMiddleware',
50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
51 | ]
52 |
53 | ROOT_URLCONF = 'ywljsec.urls'
54 |
55 | TEMPLATES = [
56 | {
57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')]
59 | ,
60 | 'APP_DIRS': True,
61 | 'OPTIONS': {
62 | 'context_processors': [
63 | 'django.template.context_processors.debug',
64 | 'django.template.context_processors.request',
65 | 'django.contrib.auth.context_processors.auth',
66 | 'django.contrib.messages.context_processors.messages',
67 | ],
68 | },
69 | },
70 | ]
71 |
72 | CACHES = {
73 | 'default': {
74 | 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
75 | 'LOCATION': 'code-cache',
76 | }
77 | }
78 |
79 |
80 |
81 | WSGI_APPLICATION = 'ywljsec.wsgi.application'
82 |
83 |
84 | # Database
85 | # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
86 |
87 | DATABASES = {
88 | 'default': {
89 | 'ENGINE': 'django.db.backends.sqlite3',
90 | 'NAME': BASE_DIR / 'db.sqlite3',
91 | }
92 | }
93 |
94 |
95 | # Password validation
96 | # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
97 |
98 | AUTH_PASSWORD_VALIDATORS = [
99 | {
100 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
101 | },
102 | {
103 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
104 | },
105 | {
106 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
107 | },
108 | {
109 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
110 | },
111 | ]
112 |
113 |
114 | # Internationalization
115 | # https://docs.djangoproject.com/en/3.2/topics/i18n/
116 |
117 | LANGUAGE_CODE = 'en-us'
118 |
119 | TIME_ZONE = 'UTC'
120 |
121 | USE_I18N = True
122 |
123 | USE_L10N = True
124 |
125 | USE_TZ = True
126 |
127 |
128 | # Static files (CSS, JavaScript, Images)
129 | # https://docs.djangoproject.com/en/3.2/howto/static-files/
130 |
131 | STATIC_URL = '/static/'
132 | # STATIC_ROOT = os.path.join(BASE_DIR, 'static')
133 | STATICFILES_DIRS = (
134 | os.path.join(BASE_DIR, 'static'),
135 | )
136 |
137 | # Default primary key field type
138 | # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
139 |
140 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
141 |
--------------------------------------------------------------------------------
/ywljsec/urls.py:
--------------------------------------------------------------------------------
1 | """ywljsec URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/
5 | Examples:
6 | Function views
7 | 1. Add an import: from my_app import views
8 | 2. Add a URL to urlpatterns: path('', views.home, name='home')
9 | Class-based views
10 | 1. Add an import: from other_app.views import Home
11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12 | Including another URLconf
13 | 1. Import the include() function: from django.urls import include, path
14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15 | """
16 | from django.contrib import admin
17 | from django.urls import path
18 | from apps.views import *
19 |
20 | urlpatterns = [
21 | path('admin/', admin.site.urls),
22 | path('', index,name="index"),
23 | path('init_data/', init_data,name='init_data'),
24 | path('shopping/', shopping,name='shopping'),
25 | path('msg_code/', msg_code,name='msg_code'),
26 | path('register/', register,name='register'),
27 | path('unauthorized_access/', unauthorized_access,name='unauthorized_access'),
28 |
29 | ]
30 |
--------------------------------------------------------------------------------
/ywljsec/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for ywljsec project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ywljsec.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------